[fpc-pascal] Ansistrings DLL/DSO hack (memory manager)

Jonas Maebe jonas.maebe at elis.ugent.be
Wed Jan 25 15:07:19 CET 2006


On 25 jan 2006, at 08:39, L505 wrote:

> Trustmaster sends me a trick/hack (as shown below) to avoid using  
> CMEM in a
> dll/dso in order to get ansistrings working through a dll/dso.
>
> Comments? Find anything that could possibly be wrong with this  
> trick we pull off?
> i.e. the ability to use strings in a DLL/DSO without ever using  
> Pchars, nor CMEM!

It's exactly the same principle as using cmem, just that you are  
using another memory manager than the one of the standard C library.  
It has the same advantages (can return and accept ansistrings to/from  
FPC-compiled programs and libararies) and problems (must not return  
and accept ansistrings to/from programs not compiled with FPC). Well,  
another advantage is of course for OS'es where the interface to libc  
changes all the time (although I doubt the interface to malloc/free  
etc will change anytime soon).


Jonas



More information about the fpc-pascal mailing list