For the first time in several years, I need to build a DLL. Now that FastMM is the default memory manager, is there any reason to make use of the old ShareMem? I am in XE7.1.

Comments

  1. Example of ancient code used for exchanging structured data via DLL APIs.
    The example only shows array of Double, but it could just as well be an array of some other structure.
    Edit - now also with actual link :P
    http://pastebin.com/8UeAazxX

    ReplyDelete
  2. Don't pass Delphi objects through your exported functions.  Pass integers, C-type strings (Null terminated PAnsiChar), doubles, etc (the C type primitives).   That way the DLL can be called from D2007 and XE7, as well as from C++, C, and C#.

    ReplyDelete
  3. We're passing records into our DLL, and the strings are byte arrays (we have to encode and decode to Ascii), but we're able to call the functions from C#.  In C# we have to define the structs as unsafe and the arrays as "fixed".

    ReplyDelete

Post a Comment