[progress Communities] [progress Openedge Abl] Forum Post: Using A Shared Library On Aix --...

Status
Not open for further replies.
S

scott_auge

Guest
Man, IBM’s XL C compiler doesn’t seem to like Progress. I got this as factorial.p procedure factorial external "/home/sauge/c/factorial.so" cdecl : define input parameter n as short. define return parameter f as short. end. /* shared library */ define variable Result as integer no-undo. run factorial (4, output Result). disp Result. /* should be 4 * 3 * 2 * 1 */ and my factorial is this: int factorial(int n) { if (n == 0) return 1; return n * factorial(n - 1); } And compiled that into /home/sauge/c/factorial.so. My pro is this: #!/bin/bash export LIBPATH=/home/sauge/c /var/dlc/bin/pro The LIBPATH and absolute path in the procedure should say use /home/sauge/c/factorial.so right? Ran my ./pro and got this: So after a WTF I wrote a runner that will load in the .so and run the program from there like Progress should. Here is run.c: #include #include #include int main(int argc, char **argv) { void *handle; int (*factorial)(int); char *error; handle = dlopen ("/home/sauge/c/factorial.so", RTLD_LAZY); if (!handle) { fputs (dlerror(), stderr); exit(1); } factorial = (int(*)(int)) dlsym(handle, "factorial"); if ((error = dlerror()) != NULL) { fputs(error, stderr); exit(1); } printf ("Factorial is %d\n", (*factorial)(4)); dlclose(handle); } And ran it: :c $ ./run Factorial is 24 Works. So… Grrrrrr All I can think is that Progress is linked with a different version of a dynamic link loader library and is confused??? Here are the build instructions: :c $ cat makefile all: factorial.c cc -c factorial.c cc -bE:factorial.exp -bM:SRE -bnoentry -o factorial.so factorial.o run: run.c cc -o run run.c -L:/home/sauge/c factorial.so -bnoquiet and the symbols :c $ cat factorial.exp factorial Anyone spot what is going on?

Continue reading...
 
Status
Not open for further replies.
Top