[fpc-pascal] calling object pascal object function in c/c++

Toan Pham tpham3783 at gmail.com
Fri Mar 25 17:16:14 CET 2011


Hi,

I am working on calling object pascal functions from c/c++.  I notice that
when a unit is compiled into object code, the name of a function is altered
in this convention:

<unit name>_<function name>$$<return type>


for example, if i have this unit:


unit wrapper;

interface

function test(): integer; stdcall;

implementation

function test(); integer; stdcall;
begin
    result := 3;
end;

end.


when the unit described above is compiled, its name changed to
"WRAPPER_TEST$$SMALLINT",
not just test like c/c++ expects at link time.  Is there a way perhaps
through fpc compiler setting or using object pascal identifier to avoid
object pascal name mangling like this?

Please help.


thank you.

Toan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20110325/2e19d3d5/attachment.html>


More information about the fpc-pascal mailing list