[fpc-pascal] UDF+FREEBSD+FIREBIRD

KES kes-kes at yandex.ru
Sat Nov 15 16:19:24 CET 2008


Здравствуйте, Stephano.

Вы писали 15 ноября 2008 г., 9:52:09:

S> 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?
>> 

S> The Firebird message gives two possible causes:
S> module name OR entry point not found

S> In your case, it could be that it is the module itself which cannot be
S> located. I noticed you copy tkes2 to the udf folder while you tell 
S> firebird the module name is libtkes2.

I have tryied both libtkes2 and tkes2 as Marc Santhoff adviced on 13 November

S> NB: This does not explain the ls -l which shows libtkes2 entries, unless
S> these are old entries

This I have wrote 12 November:

>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'

-- 
С уважением,
 KES                          mailto:kes-kes at yandex.ru




More information about the fpc-pascal mailing list