Debugging callout library <DYNAMIC LIBRARY LOAD>
I have a simple callout library:
#define ZF_DLL
#include
#include
#undef ERROR
int GetRandom(double* random) {
// Py_Initialize();
// Py_Finalize();
*random = 1.0;
return ZF_SUCCESS;
}
int main(int argc, char **argv)
{
printf("Random: ");
double random=0;
GetRandom(&random);
printf("%lf", random);
return 0;
}
ZFBEGIN
ZFENTRY("GetRandom","D",GetRandom)
ZFEND
I compile this code as a shared library and it works fine with:
set path = "library.dll"
write $ZF(-3, path, "GetRandom")
It also compiles and works as an executable.
However, when I uncomment these lines:
Py_Initialize();
Py_Finalize();
Shared library compiles, but I get <DYNAMIC LIBRARY LOAD> exception.
Executable version works without errors.
How can I debug this further?