On 06.03.2014 20:31, Chavoux Luyt wrote:
Hi everybody!

Years ago I used Delphi (on Windows) to access a C or C++ API (for
talking directly with embedded device) and I can remember that there
were a number of gotchas (e.g. the calling convention had to be changed
form Pascal to something else (extern?) etc. ).

Now I am wondering about writing a simple Lazarus GUI to the Telegram
API (all C header files, AFAICT) on Linux (and maybe Windows, if not too
difficult to port). Any gotchas to keep in mind for using C and C++
libraries from Lazarus/Free Pascal (on Linux and maybe Windows) or good
guides?

Basically: use cdecl calling convention (on Windows it *might* be stdcall though), do not use Pascal types like classes, strings, etc. for accessing the C API, better use the types in the ctypes unit instead.

Additional help is available here:

http://wiki.freepascal.org/Creating_bindings_for_C_libraries

Regards,
Sven


--
_______________________________________________
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to