Hello,
I have a requirement to create an API for application that C# can communicate with using dll (rather then REST). What is required by FPC to be able to create such DLL ?
Thanks,
Ido

Mailing lists / fpc-pascal / 2011-11
5 messages · 3 people ·
Reply by email Subscribe to this list Your subscription
Read-only archive. Use j and k to move between messages.
Hello,
I have a requirement to create an API for application that C# can communicate with using dll (rather then REST). What is required by FPC to be able to create such DLL ?
Thanks,
Ido
And one other thing I forgot, it must support classes.
Thanks, Ido
That will simply not be possible. The C# class model is fundamentally different from FPC's. Even the reverse (using C# classes from FPC) is hardly possible (although crosstalk from atozed software does a good effort in Delphi).
Michael.
And one other thing I forgot, it must support classes.
And one other thing I forgot, it must support classes.
You have to write an procedural wrapper around your class - each method gets an Procedure thar recieves the object as parameter and calls that object's method. These procedures are exported as stdcall as for an regular Windows DLL.
In C# you can write an class storing the FPC object as an IntPtr. The procedures from DLL are called using the P/Invoke mechanism.
Elmar
Thank you, it sounds like a good idea