[fpc-pascal] UDF+FREEBSD+FIREBIRD
Stephano
patspiper at yahoo.com
Sat Nov 15 08:52:09 CET 2008
KES wrote:
> library tkes2;
>
> {$mode objfpc}
> {$PACKRECORDS C}
>
>
> function somefn: integer; cdecl; export;
> begin
> somefn:= 3;
> end;
>
> exports
> //I do not do as:
> // somefn name 'somefn'; // because of this cause error tkes2(17,1) Error: Asm: Duplicate label somefn
>
> //so I do as:
> somefn name '_somefn';
>
> end.
>
> #fpc tkes2 -Xp
> Free Pascal Compiler version 2.2.0 [2008/11/09] for i386
> Copyright (c) 1993-2007 by Florian Klaempfl
> Target OS: FreeBSD/ELF for i386
> Compiling tkes2
> Linking libtkes2.so
> 17 lines compiled, 0.1 sec
>
> #ld -shared -soname libtkes2.so.1 -o libtkes2.so.1.0 -lc tkes2.o
> #cp tkes2.so /usr/local/libexec/firebird/udf/
> #cp tkes2.so.1.0 /usr/local/libexec/firebird/udf/
> #cd /usr/local/libexec/firebird/udf/
> #ls -l
> -rwxr-xr-x 1 root wheel 6022 12 ноя 04:07 libtkes2.so
> -rwxr-xr-x 1 root wheel 3219 12 ноя 04:32 libtkes2.so.1.0
>
> # /etc/rc.d/inetd restart
> Stopping inetd.
> Starting inetd.
>
> in SQL:
> DECLARE EXTERNAL FUNCTION FNTEST2
> RETURNS INTEGER BY VALUE
> ENTRY_POINT 'tkes2__somefn'
> MODULE_NAME 'libtkes2'
>
> select fntest2() from sometable;
>
> invalid requiest BLR at offset 64
> function FNTEST2 is not defined
> module name or entrypoint could not be found
>
> repeat:
> DECLARE EXTERNAL FUNCTION FNTEST2
> RETURNS INTEGER BY VALUE
> ENTRY_POINT 'tkes2_somefn'
> MODULE_NAME 'libtkes2'
>
> select fntest2() from sometable;
>
> invalid requiest BLR at offset 64
> function FNTEST2 is not defined
> module name or entrypoint could not be found
>
> another try:
>
> DECLARE EXTERNAL FUNCTION FNTEST2
> RETURNS INTEGER BY VALUE
> ENTRY_POINT '_somefn'
> MODULE_NAME 'libtkes2'
>
> select fntest2() from sometable;
>
> invalid requiest BLR at offset 64
> function FNTEST2 is not defined
> module name or entrypoint could not be found
>
>
> DECLARE EXTERNAL FUNCTION FNTEST2
> RETURNS INTEGER BY VALUE
> ENTRY_POINT 'somefn'
> MODULE_NAME 'libtkes2'
>
> select fntest2() from sometable;
>
> invalid requiest BLR at offset 64
> function FNTEST2 is not defined
> module name or entrypoint could not be found
>
>
>
> What is wrong?
>
The Firebird message gives two possible causes:
module name OR entry point not found
In your case, it could be that it is the module itself which cannot be
located. I noticed you copy tkes2 to the udf folder while you tell
firebird the module name is libtkes2.
NB: This does not explain the ls -l which shows libtkes2 entries, unless
these are old entries
HTH
More information about the fpc-pascal
mailing list