Commit 0614f36dd8ace7e76cfb05bba35d9bd623294b05
1 parent
974b02df
Exists in
master
and in
96 other branches
Check compilation version of a standard process and force recompilation if need
Showing
2 changed files
with
26 additions
and
0 deletions
Show diff stats
src/InternLib/ProcessStandard.cc
... | ... | @@ -53,6 +53,7 @@ ProcessStandard::ProcessStandard(Parameter & parameter) : |
53 | 53 | _symboleName("processFct"), |
54 | 54 | _handle(NULL), |
55 | 55 | _processInit(NULL), |
56 | + _compilVersion(NULL), | |
56 | 57 | _accesDirect(false), |
57 | 58 | _alreadyParsed(false), |
58 | 59 | _propertiesList("app.properties"), |
... | ... | @@ -68,6 +69,7 @@ ProcessStandard::ProcessStandard(const ProcessStandard & pProcess, Parameter &pa |
68 | 69 | _symboleName(pProcess._symboleName), |
69 | 70 | _handle(NULL), |
70 | 71 | _processInit(pProcess._processInit), |
72 | + _compilVersion(NULL), | |
71 | 73 | _accesDirect(pProcess._accesDirect), |
72 | 74 | _alreadyParsed(pProcess._alreadyParsed), |
73 | 75 | //_operation(pProcess._operation->clone()), |
... | ... | @@ -98,6 +100,12 @@ TimeStamp ProcessStandard::init() { |
98 | 100 | time = generateSoFile(); |
99 | 101 | } |
100 | 102 | loadDynamicLib(); |
103 | + if ((_compilVersion == NULL) || ((*_compilVersion)() != PROCESS_STANDARD_COMPIL_VERSION)) { | |
104 | + closeDynamicLib(); | |
105 | + generateCppfile(); | |
106 | + time = generateSoFile(); | |
107 | + loadDynamicLib(); | |
108 | + } | |
101 | 109 | // Create Operation && ParamData |
102 | 110 | (*_processInit)(this); |
103 | 111 | _paramData->setMinSampling(_minSampling); |
... | ... | @@ -192,6 +200,7 @@ bool ProcessStandard::findInclude(std::string name, std::string &path, std::vect |
192 | 200 | |
193 | 201 | bool ProcessStandard::mustGenerated(TimeStamp timeDepend) { |
194 | 202 | bool recompile = false; |
203 | + | |
195 | 204 | if(_timeOfSoFile == 0) { |
196 | 205 | if(_signatureTrigger != "") { |
197 | 206 | // _signatureTrigger must be a name of xml parameter file |
... | ... | @@ -257,6 +266,9 @@ bool ProcessStandard::mustGenerated(TimeStamp timeDepend) { |
257 | 266 | fileC << endl; |
258 | 267 | fileC << endl; |
259 | 268 | |
269 | + fileC << "#define PROCESS_STANDARD_COMPIL_VERSION " << PROCESS_STANDARD_COMPIL_VERSION << endl; | |
270 | + fileC << endl; | |
271 | + fileC << endl; | |
260 | 272 | |
261 | 273 | for (ParameterList::iterator it = _paramNameList.begin(); it != _paramNameList.end(); ++it) { |
262 | 274 | ParamDataSPtr p = it->second.first->getParamData(this); |
... | ... | @@ -272,6 +284,7 @@ bool ProcessStandard::mustGenerated(TimeStamp timeDepend) { |
272 | 284 | lProcessInit << "void processInit(AMDA::Parameters::ProcessStandard *pProcess)"; |
273 | 285 | fileC << "extern \"C\" " << lProcessInit.str() << ";" ; |
274 | 286 | fileC << endl; |
287 | + fileC << "extern \"C\" int compilVersion();" << endl; | |
275 | 288 | fileC << endl; |
276 | 289 | fileC << endl; |
277 | 290 | |
... | ... | @@ -329,6 +342,11 @@ bool ProcessStandard::mustGenerated(TimeStamp timeDepend) { |
329 | 342 | fileC << "}" << endl; |
330 | 343 | fileC << endl; |
331 | 344 | |
345 | + fileC << "int compilVersion() {"<< endl; | |
346 | + fileC << " return PROCESS_STANDARD_COMPIL_VERSION;"<< endl; | |
347 | + fileC << "}" << endl; | |
348 | + fileC << endl; | |
349 | + | |
332 | 350 | fileC.close(); |
333 | 351 | |
334 | 352 | } |
... | ... | @@ -415,7 +433,12 @@ void ProcessStandard::loadDynamicLib() { |
415 | 433 | BOOST_THROW_EXCEPTION(Process_exception() << AMDA::errno_code(AMDA_PROCESS_ERR) << AMDA::ex_msg(std::string("Error to parse expression: ")+_expression)); |
416 | 434 | } |
417 | 435 | |
436 | + dlerror(); /* Clear any existing error */ | |
437 | + *(void **) (&_compilVersion) = dlsym(_handle, "compilVersion"); | |
418 | 438 | |
439 | + if (dlerror() != NULL) { | |
440 | + LOG4CXX_WARN(_logger,dlerror()); | |
441 | + } | |
419 | 442 | } |
420 | 443 | |
421 | 444 | void ProcessStandard::closeDynamicLib() { | ... | ... |
src/InternLib/ProcessStandard.hh
... | ... | @@ -25,6 +25,8 @@ |
25 | 25 | #include "MultiParamProcess.hh" |
26 | 26 | #include "Parser.hh" |
27 | 27 | |
28 | +#define PROCESS_STANDARD_COMPIL_VERSION 0 | |
29 | + | |
28 | 30 | namespace AMDA { |
29 | 31 | namespace Parameters { |
30 | 32 | |
... | ... | @@ -114,6 +116,7 @@ protected: |
114 | 116 | std::string _fileNameSO; |
115 | 117 | void *_handle; |
116 | 118 | AMDA::Parameters::ParamData *(*_processInit)(Process *pProcess); |
119 | + int (*_compilVersion)(); | |
117 | 120 | bool _accesDirect; |
118 | 121 | |
119 | 122 | bool _alreadyParsed; | ... | ... |