I have a C ++ environment where some calculations are delegated (sometimes automatically generated) to C-functions or C ++ -functions with external "C" link. These are low-level routines that must be evaluated very quickly and with minimal overhead, and they are usually located in separate shared objects / DLLs. Their current signature is something like:
int my_generated_function(const double* input, double* output, double* work);
which will be in the shared library downloaded using dlopenon POSIX or LoadLibraryon Windows. The corresponding function pointers are retrieved using dlsym(handle, "my_generated_function")either POSIX or GetProcAddress(handle, TEXT("my_generated_function"))Windows.
Is it safe to carry a signature with a FILE object pointer?
int my_generated_function(const double* input, double* output, double* work,
FILE* logfile);
Note that the shared object containing my_generated_functionmay be compiled with a different (but binary compatible) compiler than the code that loads the shared object.
source
share