Re: [fpc-pascal] Linking FPC code to a C program

2010-05-24 Thread Jonas Maebe
On 24 May 2010, at 13:59, vt...@volny.cz wrote: > is it possible to link FPC compiled units to a C program on Linux? > I'm not able to figure it out. > FPC uses some strange way to name symbols and whatever I try, I always > end up with the linking errors. > I'm probably doing some trivial error

Re: [fpc-pascal] Linking FPC code to a C program

2010-05-24 Thread vtech
YES! Thank you very much. You saved my day (maybe more of them, if I had to rewrite all the pascal code to C) :) > Ah, sorry, that would be for the other direction =) > > This one should work: > > function aplusb(a,b:longint):longint;cdecl; public > name '_aplusb'; > > -- > Felipe Monteiro de

Re: [fpc-pascal] Linking FPC code to a C program

2010-05-24 Thread Felipe Monteiro de Carvalho
Ah, sorry, that would be for the other direction =) This one should work: function aplusb(a,b:longint):longint;cdecl; public name '_aplusb'; -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepa

Re: [fpc-pascal] Linking FPC code to a C program

2010-05-24 Thread vtech
I probably just found a way! alias '_aplusb'; ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Linking FPC code to a C program

2010-05-24 Thread Felipe Monteiro de Carvalho
try: function aplusb(a,b:longint):longint;cdecl; external name '_aplusb'; -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Linking FPC code to a C program

2010-05-24 Thread vtech
Hi a thank you for quick reply, but I've tried that before: Fatal: Syntax error, ";" expected but "identifier NAME" found Could it be mode dependant? (I use -Mobjfpc) V. > It's normal name mangling, just like C++ also does. > To force a > specific name try something like this: > > function apl

Re: [fpc-pascal] Linking FPC code to a C program

2010-05-24 Thread Felipe Monteiro de Carvalho
It's normal name mangling, just like C++ also does. To force a specific name try something like this: function aplusb(a,b:longint):longint;cdecl name '_aplusb'; -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org