TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Coridon Henshaw
from: Darin McBride
date: 1996-03-10 14:13:28
subject: Harm from DosExit?

CH> (I know, I know, freeing memory in a different program 
 CH> source file than it was allocated is generally 
 CH> considered a design flaw, but I couldn't think of any other way to do it.)

How I handled a similar case under Windows:

The DLL would only hand back a 'handle' to the original structure, but
would never be given access to its internals except through API calls.  I
would then use a 'lookup table' in the DLL to find the actual structure (so
I could have multiple programs querying the DLL at once).  However, I
'cheated': I used DECLARE_HANDLE32(MyDLLHandleType) to create the type and
actually gave back the pointer I was using.  ;-)  No actual tables, but the
user of the DLL didn't know that.

A requirement was that the user would have to 'close' the handle (and all I
did was cast the pointer back to the real type and delete it...).

This worked with both static and dynamically linked DLLs.


--- Maximus/2 3.01
* Origin: Tanktalus' Tower BBS (PVT) (1:342/708)
SEEN-BY: 50/99 78/0 270/101 620/243 711/401 409 410 413 430 808 809 934 955
SEEN-BY: 712/407 515 517 628 713/888 800/1 7877/2809
@PATH: 342/708 5015 61 3615/50 396/1 270/101 712/515 711/808 809 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.