Subject | RE: [firebird-support] Re: Firebird 64 bit and UDF write in Delphi (32 bit) |
---|---|
Author | Slavomir Skopalik |
Post date | 2008-12-16T01:24:20Z |
Hi,
this seem to be problem with version of UDF.
Pls. try this:
STOP FB
Copy new verison of UDF to firebird UDF directory (no more udf with same
name in system)
START FB
Check again.
Also you have to check that your udf realy export requested functions.
Another good tool is proces explorer and when FB will load function like
sleep,
you are able to check what is realy loaded.
And finaly, check that ib_util is present in system and is in 64 bit
version.
Slavek
Ing. Slavomir Skopalik
Jednatel spolecnosti
Elekt Labs s.r.o.
Chaloupky 158
783 72 Velky Tynec
Czech Republic
--------------------------------------------
Mobil: +420 724 207 851
icq:199 118 333
e-mail:skopalik@...
http://www.elektlabs.cz <http://www.elektlabs.cz/>
-----Original Message-----
From: firebird-support@yahoogroups.com
[mailto:firebird-support@yahoogroups.com] On Behalf Of mohamed.banaouas
Sent: Monday, December 15, 2008 11:21 PM
To: firebird-support@yahoogroups.com
Subject: [firebird-support] Re: Firebird 64 bit and UDF write in Delphi (32
bit)
Hi Slavek,
I did a simple 32 bit udf lib "myudf" and tested succesfully sleep
function. But when I added another kind of function
returning PCHAR, none works anymoore.
select mypchar() from rdb$database causes this msg.err:
Invalid token.
invalid request BLR at offset 63.
function MYPCHAR is not defined.
module name or entrypoint could not be found.
here is "myudf" source:
library myudf;
uses
windows, SysUtils, Classes, math, IB_Util;
//
{$IFDEF WINDOWS}
{$IFNDEF FPC}
{$R *.RES}
{$ENDIF FPC}
{$ENDIF WINDOWS}
type
PInt = ^Longint;
// DECLARE EXTERNAL FUNCTION Sleep INTEGER RETURNS INTEGER BY VALUE
ENTRY_POINT 'Sleep' MODULE_NAME 'myudf';
function Sleep(time:PINT):integer; cdecl;
begin
result:=0;
if time=nil then exit;
windows.Sleep(time^);
result := time^;
end;
// declare external function myint returns integer by value
entry_point 'myint' module_name 'myudf';
function myint: integer; cdecl;
begin
Result := 12345;
end;
// declare external function mypchar returns cstring(20) free_it
entry_point 'mypchar' module_name 'myudf';
const
MY_STRING = '1.2.3.4.5';
function mypchar: PChar; cdecl;
begin
Result := ib_util_malloc(Length(MY_STRING)+1);
StrCopy(Result,PChar(MY_STRING));
end;
exports
Sleep, myint, mypchar;
begin
end.
<http://groups.yahoo.com/;_ylc=X3oDMTJkbzRnMW9oBF9TAzk3MzU5NzE0BGdycElkAzI0N
DI0MDYEZ3Jwc3BJZAMxNzA1MTE1Mzg2BHNlYwNmdHIEc2xrA2dmcARzdGltZQMxMjI5Mzc5Njg3>
Change
<http://groups.yahoo.com/group/firebird-support/join;_ylc=X3oDMTJmZnZtdmZvBF
9TAzk3MzU5NzE0BGdycElkAzI0NDI0MDYEZ3Jwc3BJZAMxNzA1MTE1Mzg2BHNlYwNmdHIEc2xrA3
N0bmdzBHN0aW1lAzEyMjkzNzk2ODc-> settings via the Web (Yahoo! ID required)
Change settings via email: Switch
<mailto:firebird-support-digest@yahoogroups.com?subject=Email Delivery:
Digest> delivery to Daily Digest | Switch
<mailto:firebird-support-traditional@yahoogroups.com?subject=Change Delivery
Format: Traditional> format to Traditional
Visit
<http://groups.yahoo.com/group/firebird-support;_ylc=X3oDMTJkMmwwaDNzBF9TAzk
3MzU5NzE0BGdycElkAzI0NDI0MDYEZ3Jwc3BJZAMxNzA1MTE1Mzg2BHNlYwNmdHIEc2xrA2hwZgR
zdGltZQMxMjI5Mzc5Njg3> Your Group | Yahoo! Groups
<http://docs.yahoo.com/info/terms/> Terms of Use | Unsubscribe
<mailto:firebird-support-unsubscribe@yahoogroups.com?subject=>
.
<http://geo.yahoo.com/serv?s=97359714/grpId=2442406/grpspId=1705115386/msgId
=99080/stime=1229379687/nc1=3848643/nc2=4025373/nc3=4836041>
[Non-text portions of this message have been removed]
this seem to be problem with version of UDF.
Pls. try this:
STOP FB
Copy new verison of UDF to firebird UDF directory (no more udf with same
name in system)
START FB
Check again.
Also you have to check that your udf realy export requested functions.
Another good tool is proces explorer and when FB will load function like
sleep,
you are able to check what is realy loaded.
And finaly, check that ib_util is present in system and is in 64 bit
version.
Slavek
Ing. Slavomir Skopalik
Jednatel spolecnosti
Elekt Labs s.r.o.
Chaloupky 158
783 72 Velky Tynec
Czech Republic
--------------------------------------------
Mobil: +420 724 207 851
icq:199 118 333
e-mail:skopalik@...
http://www.elektlabs.cz <http://www.elektlabs.cz/>
-----Original Message-----
From: firebird-support@yahoogroups.com
[mailto:firebird-support@yahoogroups.com] On Behalf Of mohamed.banaouas
Sent: Monday, December 15, 2008 11:21 PM
To: firebird-support@yahoogroups.com
Subject: [firebird-support] Re: Firebird 64 bit and UDF write in Delphi (32
bit)
Hi Slavek,
I did a simple 32 bit udf lib "myudf" and tested succesfully sleep
function. But when I added another kind of function
returning PCHAR, none works anymoore.
select mypchar() from rdb$database causes this msg.err:
Invalid token.
invalid request BLR at offset 63.
function MYPCHAR is not defined.
module name or entrypoint could not be found.
here is "myudf" source:
library myudf;
uses
windows, SysUtils, Classes, math, IB_Util;
//
{$IFDEF WINDOWS}
{$IFNDEF FPC}
{$R *.RES}
{$ENDIF FPC}
{$ENDIF WINDOWS}
type
PInt = ^Longint;
// DECLARE EXTERNAL FUNCTION Sleep INTEGER RETURNS INTEGER BY VALUE
ENTRY_POINT 'Sleep' MODULE_NAME 'myudf';
function Sleep(time:PINT):integer; cdecl;
begin
result:=0;
if time=nil then exit;
windows.Sleep(time^);
result := time^;
end;
// declare external function myint returns integer by value
entry_point 'myint' module_name 'myudf';
function myint: integer; cdecl;
begin
Result := 12345;
end;
// declare external function mypchar returns cstring(20) free_it
entry_point 'mypchar' module_name 'myudf';
const
MY_STRING = '1.2.3.4.5';
function mypchar: PChar; cdecl;
begin
Result := ib_util_malloc(Length(MY_STRING)+1);
StrCopy(Result,PChar(MY_STRING));
end;
exports
Sleep, myint, mypchar;
begin
end.
<http://groups.yahoo.com/;_ylc=X3oDMTJkbzRnMW9oBF9TAzk3MzU5NzE0BGdycElkAzI0N
DI0MDYEZ3Jwc3BJZAMxNzA1MTE1Mzg2BHNlYwNmdHIEc2xrA2dmcARzdGltZQMxMjI5Mzc5Njg3>
Change
<http://groups.yahoo.com/group/firebird-support/join;_ylc=X3oDMTJmZnZtdmZvBF
9TAzk3MzU5NzE0BGdycElkAzI0NDI0MDYEZ3Jwc3BJZAMxNzA1MTE1Mzg2BHNlYwNmdHIEc2xrA3
N0bmdzBHN0aW1lAzEyMjkzNzk2ODc-> settings via the Web (Yahoo! ID required)
Change settings via email: Switch
<mailto:firebird-support-digest@yahoogroups.com?subject=Email Delivery:
Digest> delivery to Daily Digest | Switch
<mailto:firebird-support-traditional@yahoogroups.com?subject=Change Delivery
Format: Traditional> format to Traditional
Visit
<http://groups.yahoo.com/group/firebird-support;_ylc=X3oDMTJkMmwwaDNzBF9TAzk
3MzU5NzE0BGdycElkAzI0NDI0MDYEZ3Jwc3BJZAMxNzA1MTE1Mzg2BHNlYwNmdHIEc2xrA2hwZgR
zdGltZQMxMjI5Mzc5Njg3> Your Group | Yahoo! Groups
<http://docs.yahoo.com/info/terms/> Terms of Use | Unsubscribe
<mailto:firebird-support-unsubscribe@yahoogroups.com?subject=>
.
<http://geo.yahoo.com/serv?s=97359714/grpId=2442406/grpspId=1705115386/msgId
=99080/stime=1229379687/nc1=3848643/nc2=4025373/nc3=4836041>
[Non-text portions of this message have been removed]