I try to create a shared library with gcc compiler on hp-ux. I use these commands:
Everything compiles without warnings or errors, but when I try to use that library, I get an error:
ERROR: Extension Load Failure: OS Error: -1 ('path_to_lib' is not a valid load module: Bad magic number).
ERROR: Unable to load extension: (path_to_lib).
ERROR: Extension Load Failure: OS Error: -1 ('path_to_lib' is not a valid load module: Bad magic number)
Do you know what does this error exactly mean? How to fix it?
EDITED: I use my shared library in SAS program like this:
proc proto package =work.myfuncs.tests;
link "/home/my_library.so";
int test(int x);
run;
I finally resolved my problem. I had to create library as 64 bits library with gcc option -mlp64
, because SAS software was 64 bits. However, I still don't know why proc proto
worked correctly on LINUX, because SAS software is 64b there too. Maybe it had too be something with different gcc instalations over these two environments.