Skip to content

Commit a0c3353

Browse files
Do not write and read autogenerated code in CppAD Codegen but use the code kept in memory. This removes a race condition that can lead to crashes when multiple instances of CppAD Codegen generate the same models.
Approved-by: Farbod Farshidian
1 parent 6b20067 commit a0c3353

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

ocs2_thirdparty/include/cppad/cg/model/compiler/abstract_c_compiler.hpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -222,13 +222,9 @@ class AbstractCCompiler : public CCompiler<Base> {
222222
sourceFile.open(srcfile.c_str());
223223
sourceFile << it->second;
224224
sourceFile.close();
225-
226-
// compile the file
227-
compileFile(srcfile, file, posIndepCode);
228-
} else {
229-
// compile without saving the source code to disk
230-
compileSource(it->second, file, posIndepCode);
231225
}
226+
// compile library from source code in memory
227+
compileSource(it->second, file, posIndepCode);
232228

233229
if (timer != nullptr) {
234230
timer->finishedJob();

0 commit comments

Comments
 (0)