[fpc-pascal] Delphi ShareMem -DLL-pchar

afpTeam afpteam at sbcglobal.net
Tue Sep 5 23:59:09 CEST 2006


Can anyone comment on the Delphi unit "ShareMem" and if FPC ever did any 
work to incorporate what this Delphi unit is doing for DLL shared memory 
managment?  I'm looking so far, at the docs on creating a memory manager, 
and at the strings unit, which has some pchar utilities in it.

This article, http://delphi.about.com/od/objectpascalide/l/aa103003a.htm 
explains much about the Delphi related, Win32 DLL pointer and shared memory 
problems.  I'm working on creating a DLL between two Win32 applications, but 
having a lot of exception and pointer related problems to do with pchar and 
asciiz data transfer.

Simple type casting is definately out.  And when exchanging Asciiz data 
through a DLL between two Win32 applications, it appears that reserving & 
freeing memory for passing pchars, may not be an adequate solution either as 
the Win32 apps rely on Win32 API to do a lot of management behind the scenes 
for parameter passing/DLL.

Worse, the data on the client side of my DLL is passing var ref variant type 
parameters with only one true shortstring parameter among 8 other variants 
and the return is a shortstring also.

Accordingly, I'm trying to decide whether to manage the pchar data more 
aggressively, or move to a different string construct, or fall back to an 
EXE with with socket/server, which would allow me to still access the server 
side app via it's DLL directly and the client side App, via the socket, 
(this would let me remote that side of the application anyhow, which might 
be nice and would get rid of the variant types).

Thank you for any comments, suggestions, opinions or other questions I can 


avast! Antivirus: Outbound message clean.
Virus Database (VPS): 0635-5, 09/04/2006
Tested on: 9/5/2006 5:59:10 PM
avast! - copyright (c) 1988-2006 ALWIL Software.

More information about the fpc-pascal mailing list