[fpc-pascal] UDF+FREEBSD+FIREBIRD FPC generate wrong object file???
Michael Van Canneyt
michael at freepascal.org
Sat Nov 15 23:29:22 CET 2008
On Sat, 15 Nov 2008, KES wrote:
> Здравствуйте, Michael.
>
> Вы писали 15 ноября 2008 г., 23:28:10:
>
>
>
> MVC> On Sat, 15 Nov 2008, KES wrote:
>
> >> Здравствуйте
> >>
> >> h) select fntest() from rdb$database
> >> i) invalid requiest BLR at offset 60
> >> function FNTEST is not defined
> >> module name or entrypoint could not be found
> >>
> >>
> >> CONCLUSION: FPC generate wrong object file???
>
> MVC> Not necessarily. Please try to load the library from a plain C program.
>
> MVC> My guess is that dlopen() will return an error.
>
> MVC> Then do the same for the library with a pascal program.
>
> MVC> Michael.
>
> I do not know how to load the library from a plain C program. Can you
> help me?
Something like this should do it:
home: >cat testl.c
#include <dlfcn.h>
#include <stdio.h>
int main () {
void * p;
void * ps;
p=dlopen("testudf.so",RTLD_NOW);
if (p==NULL) {
printf("loading library failed %s\n",dlerror());
} else {
printf("loading library OK\n");
ps = dlsym(p,"fn_test");
if (ps==NULL) {
printf("symbol not found\n");
} else {
printf("Symbol found OK\n");
}
dlclose(p);
}
}
home: >gcc -ldl testl.c
home: >./a.out
loading library failed testudf.so: cannot open shared object file: No such file or directory
Of course, you must correct the names.
Michael.
More information about the fpc-pascal
mailing list