Subject | Re: Problem with loading libfbclient.so under linux |
---|---|
Author | Marius popa |
Post date | 2008-12-10T16:28:46Z |
--- In firebird-support@yahoogroups.com, "b0bik2000" <b0bik@...> wrote:
ib_util_malloc
see this solution
http://tech.groups.yahoo.com/group/firebird-support/message/98796
why ? i quote
http://firebirdsql.org/index.php?op=useful&id=deatz_udf
But what about strings and dates?
What about 'em anyway? A string and a date are not considered "scalar"
values in InterBase-ese, so special care must be taken when returning
their values to InterBase.
ps: i have tried to compile it on my ubuntu 64bit box but i have an
error with fpc 2.2.2
Linking libtest.so
test.dpr(9) Error: Can't call the linker, switching to external linking
test.dpr(9) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted
Error: /usr/bin/ppcx64 returned an error exitcode (normal if you did
not specify a source file to be compiled)
>you might need to use
> Hello
>
> I have a little problem with udf function that needs to load fbclient
> library under linux.
>
> It is about: FirebirdSS-2.1.1.17910-0.ntpl.i686.tar.gz.tar
>
> After "instalation" I did following things:
>
> 1. aliases.conf - new line pointing to my fdb file
> 2. firebird.conf:
> RemoteServicePort = 5005
> UdfAccess = Restrict UDF
> BugcheckAbort = 1
> 3. Restart firebird server
>
> I created a simple library with - Free Pascal Compiler:
>
> test.dpr:
>
> library test;
>
> uses funcs in 'funcs.pas';
>
> exports ftest;
>
> begin
> end.
>
> funcs.pas:
>
> unit funcs;
>
> interface
>
> uses Types;
>
> type
>
> TM = record
> tm_sec: integer;
> tm_min: integer;
> tm_hour: integer;
> tm_mday: integer;
> tm_mon: integer;
> tm_year: integer;
> tm_wday: integer;
> tm_yday: integer;
> tm_isdst: integer;
> end;
>
> ISC_TIMESTAMP = record
> timestamp_data: LongInt;
> timestamp_time: DWord;
> end;
>
> PTM = ^TM;
> PISC_TIMESTAMP = ^ISC_TIMESTAMP;
>
> procedure isc_decode_timestamp(ib_date: PISC_TIMESTAMP; tm_date: PTM);
> cdecl; external 'fbclient';
> function ib_util_malloc(l: integer): pointer; cdecl; external
> 'ib_util';
>
> function ftest(aDateTime : PISC_TIMESTAMP): Integer; cdecl;
>
> implementation
>
> function ftest(aDateTime: PISC_TIMESTAMP): Integer; cdecl;
> var theTM: TM;
> begin
> Result := 0;
> isc_decode_timestamp(aDateTime, @theTM); {*}
> Result := 1;
> end;
>
> end.
>
> After building library I copied it into UDF directory
> (/opt/firebird/UDF/)
>
> I declared external function using:
>
> DECLARE EXTERNAL FUNCTION FTEST
> TIMESTAMP NULL
> RETURNS INTEGER BY VALUE
> ENTRY_POINT 'ftest'
> MODULE_NAME 'test'
>
> After committing, I connected to my database using isql utility and
> run a query:
>
> select ftest(current_timestamp) from rdb$database
>
> and nothing, query execution never ends. But neither fbserver nor
> fbguard process takes lot of CPU time. When I connect to Linux machine
> from Windows (using flamerobin) and execute the same query, flame
> writes:
>
> "Starting transaction ..."
>
> and nothing happens too.
>
>
> When I comment line marked with {*} in my udf everything works OK.
>
> Where did I make mistake ?
ib_util_malloc
see this solution
http://tech.groups.yahoo.com/group/firebird-support/message/98796
why ? i quote
http://firebirdsql.org/index.php?op=useful&id=deatz_udf
But what about strings and dates?
What about 'em anyway? A string and a date are not considered "scalar"
values in InterBase-ese, so special care must be taken when returning
their values to InterBase.
ps: i have tried to compile it on my ubuntu 64bit box but i have an
error with fpc 2.2.2
Linking libtest.so
test.dpr(9) Error: Can't call the linker, switching to external linking
test.dpr(9) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted
Error: /usr/bin/ppcx64 returned an error exitcode (normal if you did
not specify a source file to be compiled)
>
> Best regards
> b0bik
>