Forum > General

[SOLVED] fpc libraries do not work in freeBSD...

(1/3) > >>

Fred vS:
Hello everybody.

I have posted this question in fpc-mailing list but... no answers.  :'(

So i try here  :-[

Fpc libraries compiled on freeBSD are unusable.
Python, Java, C and even fpc applications can not use them in freeBSD...

Look at that  (works on Linux):  =>

>> The fpc library: =>

--- Code: ---library test ;
{$mode objfpc}

procedure fpctest(); cdecl;
begin
writeln('OK, it works...');
end;

exports
fpctest name 'fpctest';

begin
end.
--- End code ---

>> The Python script: =>

--- Code: ---#file fp_test.py
import string
import os,sys,platform
dia = sys.path[0]
from ctypes import*
fp_lib = "libtest.so"
fppathdll = os.path.join( dia , fp_lib)
fpdll = cdll.LoadLibrary(fppathdll)
fpdll.fpctest
--- End code ---

Compile test.pas and run the python script: =>

>> python fp_test.py


=> Does not work and same error if fpc library is used by Python, Java (fpc lib compiled with Java-syntax), C or fpc applications:


--- Quote ---> ~/libtest.so: Undefined symbol
> "operatingsystem_parameter_envp"
--- End quote ---

How can i help to fix that ?

Thanks.

Fred.

taazz:
why are you always testing difficult things? What makes you think that python will set the console correctly and even more why do you thing that python will set your internal console variables correctly? How about start by returning an integer lets say 42 from a function and make sure that the function is declared as cDecl instead of pascal that is the default.

Fred vS:

--- Quote ---why are you always testing difficult things? What makes you think that python will set the console correctly and even more why do you thing that python will set your internal console variables correctly? How about start by returning an integer lets say 42 from a function and make sure that the function is declared as cDecl instead of pascal that is the default.
--- End quote ---

Hello taaz.

Hum, sorry but i do not understand you.
Is that fpc test-library so complicated ?

How can Python run simpler a imported function from a library ?
That code works perfectly on Linux 32/64 and Windows 32/64.
[edit] For windows, change in python code : fp_lib = "libtest.so" => fp_lib = "test.dll"

It does not work on freeBSD.

 

taazz:

--- Code: ---////////////////
library test ;
{$mode objfpc}

function fpctest:integer;cdecl;
begin
  Result := 42;
end;

exports
fpctest name 'fpctest';

begin
end.
////////////////

--- End code ---

Fred vS:
Ok taazz, i will test your simpler library.  :-X

If it works, i offer you all what you want  ;)

But if it does not work, are you ok to help me to find the solution for fpc freeBSD libraries ?

Navigation

[0] Message Index

[#] Next page

Go to full version