On 08 May 2010, at 21:37, moic...@gmx.de wrote:

> I have a C file which I want to link statically into my FreePascal 
> application. The C code is mostly self-contained, except for a few simple 
> calls to the C runtime, one of them being "_strlen".
> 
> Now "_strlen" is a simple enough function to rewrite it in Pascal, and so I 
> did. However, FreePascal seems unable to recognize my strlen function in 
> Pascal. It keeps reporting "Error: Undefined symbol: _strlen". My code looks 
> like this, and "_strlen" is clearly present:

C name mangling is not the same on all systems. On several systems, if you 
declare a function called "strlen" in C, the assembler symbol will actually be 
called "_strlen". The C compiler automatically adds the "_" prefix if 
necessary, and so does FPC when you use the "cdecl" calling convention. So 
change the "_strlen" into "strlen" and try again.


Jonas_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to