Using 3rd party C based SDKs lazarus / 8-Other ---------------------------------------------------------------------- henrytj · 2007-09-26 15:21 Can SDKs from 3rd parties written for C be used in Free Pascal and Lazarus?  If so, what is the general procedure? Or is there documentation on this. (My first search turned up little and I will be away and cannot research this for a day or two.) Just looking to be pointed in the right direction. Henry ---------------------------------------------------------------------- Almindor · 2007-09-26 16:23 Yes, as long as it's base C (eg: not C++ with objects). C++ can also be made working (see Qt interface) but requires a special "wrapper" lib. For C SDKs, you need to translate the .h files that come with them into pascal units. This can be somewhat automated with the use of h2pas (comes with fpc) utility (don't expect 100% translation tho). For example, let's say the C library "libexample.so" (in windows "example.dll") exports this function in example.h: int example_func(unsigned long arg1, const char* arg2); The translation would be: Code: [Select] uses cTypes; // for c types aliases const   LibName = 'libexample.so'; // ifdef this to specific platforms function ExampleFunc(arg1: culong; arg2: pChar): cInt; cdecl; external LibName name 'example_func'; In this example, I renamed the example_func() to ExampleFunc and put the "C" name after the name directive. If you keep the names intact (case sensitive!) then you can omit the name part. It's sometimes good idea to keep same names of the functions, but sometimes you might want to "Pascalize" the names (not recommended tho). This is the basics, there's much more about this, but I'm not sure where you could find info on it. Try the wikis perhaps. ---------------------------------------------------------------------- henrytj · 2007-09-30 02:35 I haven't installed the SDK yet, but it seems to contain .h files and .dll's. In my old VAX Fortran days all you needed was the name of the routines to call and argument list info and then you could link with about any routine in an "object" file, or object library. You compiled and linked in separate command line steps. However, the SDK zip archive does contain an example in VB6, VCPP6, and Dephi. So I will be studying those when I get the chance. BTW, I remotely recall using Win API calls from VB when I dabbled with that years ago. Henry ---------------------------------------------------------------------- Phil · 2007-10-08 17:49 Quote from: "henrytj"However, the SDK zip archive does contain an example in VB6, VCPP6, and Dephi. So I will be studying those when I get the chance. If you have Delphi code examples for using the SDK, they should work with Lazarus and Free Pascal too.