Re: Euphoria and Xwindows
- Posted by Sammy Mitchell <sammy at SEMWARE.COM> Jul 27, 1999
- 359 views
>GraphApp isn't really set up for compiling as a DLL for a few reasons. > >Firstly, DLLs are loaded once, and then any memory used by that DLL >is shared by all the programs using the DLL. So, if one program >starts using a GraphApp DLL, all other GraphApp programs will be using >the same library memory space. > >Since only one program could use the DLL at one time, there is no >point in making it a DLL. A DLL is, by definition, meant to be >shared amongst many applications, but you cannot do that if you are >using global variables in the library, as GraphApp does. > >really to do with GraphApp, it's really a memory management issue >with the way Windows implements shared libraries. If you could tell >a DLL to be a shared code library, but to *not* use shared memory, >then everything would work fine. While this is definitely the case with 16-bit Windows (Windows 3.x), 32-bit Windows (95/98/NT/2000) does not have this problem. Quoting from "Advanced Windows" by Jeffrey Richter: "DLLs in Win32 don't receive their own local heaps. Second, a Win32 DLL's global and static variables are not shared among multiple mappings of the DLL - the system creates an instance of the global data for each process, and each instance will not have the same value when the DLL is mapped into multiple processes' address spaces." It turns out, that this (that DLL's no longer share global data) is one of the problems in porting from 16-bit to 32-bit windows. Sharing data among multiple processes is much harder in 32-bit windows than 16-bit Windows. 32- bit Windows tries very hard to keep you from messing with other peoples data. There is a way to share data among DLL's in 32-bit Windows, but it won't just happen without additional work on the part of the programmer. Unless GraphApp is doing something really strange (and from first glance, it appears to be very tame), it should be possible to compile it as a Win32 DLL, without any "shared memory" problems. Of course someone has to make all the necessary functions and data exportable, which is compiler dependant, but once that is done, it should (theoretically) be easy. <grin> (it always seems easy, if you're not the one who is actually doing it!) So don't give up quite yet! -- Sammy Mitchell