[fpc-pascal]UDF + FreePascal + Firebird 1.5
I created a UDF, just to test and try to discovery what's wrong. I ill explain what I did step by step. I created a teste.pas file like this: library teste; function intmax(a,b: Integer): Integer; stdcall; export; begin if a>b then intmax:=a else intmax:=b; end; exports intmax; end. I compile with freepascal: fpc teste I moved to udf directory on firebird: mv libteste.so /usr/local/firebird/UDF/ I changed permissions: cd /usr/local/firebird/UDF chown firebird:firebird libteste.so chmod 550 libteste.so I declared UDF: DECLARE EXTERNAL FUNCTION INTMAX INTEGER, INTEGER RETURNS INTEGER BY VALUE ENTRY_POINT 'intmax' MODULE_NAME 'teste'; I test it: select intmax(1,2) from rdb$database; And I got this error message: Invalid token. invalid request BLR at offset 60. function INTMAX is not defined. module name or entrypoint could not be found. Does anyone have any ideas? Thanks in advance, Guto ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal]UDF + FreePascal + Firebird 1.5
I tried with both, but I get the same error... I wrote the same lib in C, and works fine, but I wouldnt like to maintain a C version of all my libraries (actually written in Delphi)... I believe thats a directive of something like that I must to use to works in FreePascal. Any idea? Thanks, Guto On Sat, 24 Jul 2004 16:21:23 +0200 (CEST), Marco van de Voort <[EMAIL PROTECTED]> wrote: > > > > I created a UDF, just to test and try to discovery what's wrong. > > I ill explain what I did step by step. > > > > I created a teste.pas file like this: > > > > > > > > library teste; > > > > function intmax(a,b: Integer): Integer; stdcall; export; > > begin > > if a>b then intmax:=a else intmax:=b; > > end; > > > > exports > > intmax; > > > > end. > > > > > > > > I compile with freepascal: > > fpc teste > > > > I moved to udf directory on firebird: > > mv libteste.so /usr/local/firebird/UDF/ > > > > I changed permissions: > > cd /usr/local/firebird/UDF > > chown firebird:firebird libteste.so > > chmod 550 libteste.so > > > > I declared UDF: > > > > DECLARE EXTERNAL FUNCTION INTMAX > >INTEGER, > >INTEGER > > RETURNS INTEGER BY VALUE > > ENTRY_POINT 'intmax' MODULE_NAME 'teste'; > > > > I test it: > > select intmax(1,2) from rdb$database; > > > > And I got this error message: > > Invalid token. > > invalid request BLR at offset 60. > > function INTMAX is not defined. > > module name or entrypoint could not be found. > > > > Does anyone have any ideas? > > > > Are you 100% sure it doesn't have to be cdecl; instead of stdcall on *nix? > > ___ > fpc-pascal maillist - [EMAIL PROTECTED] > http://lists.freepascal.org/mailman/listinfo/fpc-pascal > -- Guto ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal]UDF + FreePascal + Firebird 1.5
I believe, thats "cdecl", this is not explicit, and I get this example from http://www.firebirdsql.org/index.php?op=useful&id=deatz_udf#linux the function is: int modulo(int *, int *); int modulo(a, b) int *a; int *b; { if (*b == 0) return -1; else return *a % *b; } and I compiled with: gcc -c -O -fpic -fwritable-strings testec.c ld -G .o -lm -lc -o testec.so cp testec.so /usr/local/firebird/UDF and I declared with: declare external function f_Modulo integer, integer returns integer by value entry_point 'modulo' module_name 'name of shared library'; On Sat, 24 Jul 2004 17:48:29 +0200 (CEST), Marco van de Voort <[EMAIL PROTECTED]> wrote: > > I tried with both, but I get the same error... > > > > I wrote the same lib in C, and works fine, but I wouldnt like to > > maintain a C version of all my libraries (actually written in > > Delphi)... > > How is the C stuff defined? With stdcall or cdecl? > > > I believe thats a directive of something like that I must to use to > > works in FreePascal. > > Maybe it needs pic or so > > > > ___ > fpc-pascal maillist - [EMAIL PROTECTED] > http://lists.freepascal.org/mailman/listinfo/fpc-pascal > -- Guto ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal]UDF + FreePascal + Firebird 1.5
> - I am confused about the changing of owner and permissions. Have you tried > changing it to root, with permissions 755 ? I copied the permissions from other firebird standard libraries... Whell, Im do this now (and the error remains): contents of teste.pas: {$mode objfpc} library teste; function intmax(a,b: Integer): Integer; cdecl; export; begin if a>b then intmax:=a else intmax:=b; end; exports intmax; end. - # fpc teste.pas # mv libteste.so teste.so # mv teste.so /usr/local/firebird/UDF/ (I not change the permissions this time) # ls -l teste.so -rwxr-xr-x 1 root wheel 223551 24 Jul 13:56 teste.so* in the IBExpert: DECLARE EXTERNAL FUNCTION INTMAX INTEGER, INTEGER RETURNS INTEGER BY VALUE ENTRY_POINT 'intmax' MODULE_NAME 'teste'; select intmax(3, 2) from rdb$database; and the error: Invalid token. invalid request BLR at offset 60. function INTMAX is not defined. module name or entrypoint could not be found. ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal]UDF + FreePascal + Firebird 1.5
> What version of FPC did you use ? 1.9.2 On Sun, 25 Jul 2004 00:12:15 +0200 (CEST), [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > On Sat, 24 Jul 2004, Guto wrote: > > > > - I am confused about the changing of owner and permissions. Have you tried > > > changing it to root, with permissions 755 ? > > > > I copied the permissions from other firebird standard libraries... > > > > Whell, Im do this now (and the error remains): > > > > contents of teste.pas: > > > > {$mode objfpc} > > > > library teste; > > > > function intmax(a,b: Integer): Integer; cdecl; export; > > begin > > if a>b then intmax:=a else intmax:=b; > > end; > > > > exports > > intmax; > > > > end. > > > > - > > > > # fpc teste.pas > > # mv libteste.so teste.so > > # mv teste.so /usr/local/firebird/UDF/ > > > > (I not change the permissions this time) > > # ls -l teste.so > > -rwxr-xr-x 1 root wheel 223551 24 Jul 13:56 teste.so* > > > > in the IBExpert: > > > > DECLARE EXTERNAL FUNCTION INTMAX > > INTEGER, > > INTEGER > > RETURNS INTEGER BY VALUE > > ENTRY_POINT 'intmax' MODULE_NAME 'teste'; > > > > select intmax(3, 2) from rdb$database; > > Very strange. I tried it here, and it works fine for me. I have Firebird 1.5 > installed, so > > What version of FPC did you use ? > > Michael. > > > > ___ > fpc-pascal maillist - [EMAIL PROTECTED] > http://lists.freepascal.org/mailman/listinfo/fpc-pascal > -- Guto ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal]UDF + FreePascal + Firebird 1.5
> try: > fpc teste.pp -Xp > ld -shared -soname libteste.so.1 -o libteste.so.1.0 -lc teste.o does not work ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal]Re: [firebird-support] Re: UDF + FreeBsd + FreePascal
I'm realizing this now... I think that's necessary notify FreePascal development team about that... My WebServer is FreeBSD and my FileServer is Windows NT... Im migrating Windows to FreeBSD too... To maintain the same OS in all servers... But, in face of that, I realize that Linux will be the solution... Thanks, Guto On Thu, 29 Jul 2004 06:29:32 -, szdfs2003 <[EMAIL PROTECTED]> wrote: > I have such problem, I try do it about month, > but use C language - and no problems. > > FreePascal UDF`s - not working under FreeBSD, > under Linux - use Kylix - and all working! > > > Anyone uses FreePascal to compile UDFs to Firebird on FreeBSD? > > I still having problems with that... > > > > Its works or not? Or only in Linux? > > > Yahoo! Groups Sponsor ~--> > Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar. > Now with Pop-Up Blocker. Get it for free! > http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/67folB/TM > ~-> > > > Yahoo! Groups Links > > <*> To visit your group on the web, go to: >http://groups.yahoo.com/group/firebird-support/ > > <*> To unsubscribe from this group, send an email to: > [EMAIL PROTECTED] > > <*> Your use of Yahoo! Groups is subject to: >http://docs.yahoo.com/info/terms/ > > -- Guto ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal]UDF + FreePascal + Firebird 1.5
> > I believe thats a directive of something like that I must to use to > > works in FreePascal. > > Maybe it needs pic or so What means "pic" or "so" ? Thanks, Guto ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal]UDF + FreePascal + Firebird 1.5
On Sat, 24 Jul 2004 19:43:45 +0200 (CEST), Marco van de Voort <[EMAIL PROTECTED]> wrote: > try: > > fpc teste.pp -Xp > ld -shared -soname libteste.so.1 -o libteste.so.1.0 -lc teste.o Whell, doesnt work too... Why needs ".1" and ".1.0" at the end of lib name? Thanks, Guto ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal]UDF + FreePascal + Firebird 1.5
On Sun, 25 Jul 2004 00:12:15 +0200 (CEST), [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Very strange. I tried it here, and it works fine for me. I have Firebird 1.5 > installed, so > > What version of FPC did you use ? > > Michael. Do you test on FreeBSD? I tried with FreePascal 1.0.10, 1.9.2 and 1.9.4, always with the same results... Thanks Guto ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal]UDF + FreePascal + Firebird 1.5
On Thu, 29 Jul 2004 16:23:51 +0200 (CEST), Marco van de Voort <[EMAIL PROTECTED]> wrote: > > On Sat, 24 Jul 2004 19:43:45 +0200 (CEST), Marco van de Voort > > <[EMAIL PROTECTED]> wrote: > > > > > try: > > > > > > fpc teste.pp -Xp > > > ld -shared -soname libteste.so.1 -o libteste.so.1.0 -lc teste.o > > > > Whell, doesnt work too... > > Well, what doesn't work. I receive the same errors on Firebird that I received before: "module name or entrypoint could not be found" Thanks, Guto ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal]UDF + FreePascal + Firebird 1.5
i list the entry points with nm -g the entry point was there I really dont know whats happen... Guto On Thu, 29 Jul 2004 17:36:05 +0200 (W. Europe Daylight Time), Michael Van Canneyt <[EMAIL PROTECTED]> wrote: > > > > > On Thu, 29 Jul 2004, Guto wrote: > > > On Thu, 29 Jul 2004 16:23:51 +0200 (CEST), Marco van de Voort > > <[EMAIL PROTECTED]> wrote: > > > > On Sat, 24 Jul 2004 19:43:45 +0200 (CEST), Marco van de Voort > > > > <[EMAIL PROTECTED]> wrote: > > > > > > > > > try: > > > > > > > > > > fpc teste.pp -Xp > > > > > ld -shared -soname libteste.so.1 -o libteste.so.1.0 -lc teste.o > > > > > > > > Whell, doesnt work too... > > > > > > Well, what doesn't work. > > > > I receive the same errors on Firebird that I received before: > > "module name or entrypoint could not be found" > > Can you at least dump the entry points of the library ? > if you see the maxint (or was it intmax) listed there, you know that it > is firebird which does not find the library. > > Michael. > > > > ___ > fpc-pascal maillist - [EMAIL PROTECTED] > http://lists.freepascal.org/mailman/listinfo/fpc-pascal > -- Guto ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal]UDF + FreePascal + Firebird 1.5
I used in a FPC program and in a C program and works... I write a UDF in C and used it on Firebird and works too... Only not works a FPC UDF in Firebird... I really dont know whats happen... I believe that FPC dont generate a lib in a format that Firebird understands Thanks Guto On Thu, 29 Jul 2004 18:52:17 +0200 (CEST), [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > On Thu, 29 Jul 2004, Guto wrote: > > > i list the entry points with nm -g > > the entry point was there > > > > I really dont know whats happen... > > Did you try loading the library explicitly in a FPC test program and calling > the function (I believe I posted a program where this was done) > > Because if that works, then it is a Firebird issue. > > > > Michael. > > ___ > fpc-pascal maillist - [EMAIL PROTECTED] > http://lists.freepascal.org/mailman/listinfo/fpc-pascal > -- Guto ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal