Question
· Dec 16, 2018

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?

Discussion (4)0
Log in or sign up to continue

when you get the error <DYNAMIC LIBRARY LOAD>, you should look at cconsole.log (or messages.log for IRIS), where you may find code of error.

Thank you. Got this error

Error loading dll (c:\users\eduard\eclipse-c-workspace\helloworld\debuglib\libhelloworld.dll) is 126

It is possible that you build it for 32bit, but uses in 64bit instance.  In this case, you will get the error with code 139. if you got other code, you can google it.

I can get it to work if I compile it without a few lines, so I'm sure it's 64bit.