[fpc-pascal] UDF+FREEBSD+FIREBIRD

Michael Van Canneyt michael at freepascal.org
Sat Nov 15 11:23:55 CET 2008



On Sat, 15 Nov 2008, KES wrote:

> Здравствуйте, Michael.
> 
> Вы писали 15 ноября 2008 г., 2:52:48:
> 
> 
> 
> MVC> On Sat, 15 Nov 2008, KES wrote:
> 
> >> Здравствуйте, Michael.
> 
> MVC> Zdravstvuyte...
> 
> >> >> I have tryied my example to compile in Delphi. Then I use DLL in
> >> >> FireBird on Win32. All works fine. So my source file is good
> >> >> and therefore FreePascal can not compile shared library that can be
> >> >> recognized by FireBird (((
> >> 
> >> MVC> Did you specify cdecl as the calling convention for non-windows ?
> >> MVC> If it works on windows, it almost surely does not work straight out
> >> MVC> of the box on unices, because the calling convention will be wrong.
> >> 
> >> MVC> Michael.
> >> 
> >> This is last my try:
> >> 
> >> library MyUDF;
> >> 
> >> 
> >> function somefn: integer; cdecl; export;
> >> begin
> >>  somefn:= 3;
> >> end;
> >> 
> >> exports
> >>  somefn name '_somefn';
> >> end.
> >> 
> >> On win32 it works, on FreeBSD does not
> 
> MVC> I compiled the library, and checked the contents:
> 
> home: >>objdump -t libmyudf.so  
> 
> MVC> 00004a20 g     F .text  00000005 _somefn
> 
> MVC> So the symbol is present, as you declared it in your library. 
> MVC> That part seems OK.
> 
> MVC> How do you declare your function in Firebird ?
> MVC> Does it have the _ ? 
> MVC> and the correct casing ?
> 
> MVC> Michael.
> 
> I have tryied with and without _
> 
> DECLARE EXTERNAL FUNCTION FNTEST
>   RETURNS INTEGER
>   ENTRY_POINT 'somefn'
>   MODULE_NAME 'myudf'
> 
> 
> DECLARE EXTERNAL FUNCTION FNTEST
>   RETURNS INTEGER
>   ENTRY_POINT '_somefn'
>   MODULE_NAME 'myudf'

Did you try changing the name myudf to libmyudf.so or libmyudf ?
I don't think that the 'lib' is prefixed automatically.

Michael.


More information about the fpc-pascal mailing list