string - AnsiString return values from a Delphi 2007 DLL in a Delphi 2009 application -


I have a DLL that has been compiled with D200, which functions which returns the encoding.

My application is compiled in D2009. When it calls the AnsiString function, it comes back to the trash.

I have created a little test application / DLL for the experiment and have found out that if both apps and DLL Delphi have the same version (either 2007 or 2009), there is no problem. But when one is compiled in 2009 and 2007, I get garbage.

I have tried to include the latest version of FastMM in both projects, but still can not read encryption from the 2009 app 2007 DLL.

Any ideas of what is going wrong here? Is there any way to work on this?

The internal structure of the deinstallation has been changed between Delphi 2007 and Delphi 2009. (Do not disturb; This possibility exists for 1 day.) A Delphi 2009 string keeps the number reflecting how its data is.

I do every other DLL earth and pass the buffers of that character which can fill the function. The caller should give the number indicating the buffer pointer and buffer size. (Make sure you are clear whether you measure the size in bytes or letters) or not. The DLL function fills the buffer, is not writing more than the given size, and calculates the futile tap character.

If the caller does not know how much byte the buffer should be, then you have two options:

  • DLL behaves in particular when the input buffer Pointer is zero. In that case, it returns the required size so that the caller can allocate that space and call the function for the second time.

  • Whether DLL allocates its space, a pre-determined method is available for the caller to free buffer later. The DLL can either export a function to free buffer, or you can specify some available API function for the use of the collar, such as GlobalFree to your DLL related allocation API Use, such as GlobalAlloc (do not use Delphi's underlying memory-allocation functions like GetMem or new ; there is no guarantee That the caller's memory manager will know this How to call or dissection , even if it's written in the same language, even if it's written in the same Delphi version.)

    < In addition, it is selfish to write a DLL that can be used by only one language, write your DLL in the same style as Windows API and you can not go wrong.


Comments

Popular posts from this blog

c++ - Linux and clipboard -

Visual Studio 2005: How to speed up builds when a VSMDI is open? -

booting ubuntu from usb using virtualbox -