Re: Allocate and De-allocate in Multi-DLL Program
"Norman Bullen" wrote:
Can I throw an object from a DLL and have it caught in the EXE?
Yes, you can do it. It's a common practice. Take, for example, MFC
library or standard C++ library. You can link dynamically with
both of them and they throw exceptions that a client can catch
without a problem. You will need the same compiler for both DLL
and EXE in order to make it work, though.
[...] if an object has a virtual destructor and both constructor
and destructor are inline, delete will call the destructor in
the same module that constucted the object, regardless of where
the delete is. Can anyone find ground to disagree with that?
You're correct here. Virtual functions are not inline even if you
wrote them inline. There must be an outstanding body of a function
in order to put a pointer to it in class' vtbl. Virtual tables
work perfectly across EXE/DLL modules. You can take the MFC
library as an example again where user can override virtual
methods of MFC classes. Of course, in this case too, you will need
the same compiler for both DLL and EXE.
Alternatively, I could link the programs and all of the DLLs
with the DLL run-time libraries. This would result, if I
understand correctly, in a single heap being used across the
Can I still count on DLL libraries that are compatible with VC
6.0 being installed on every Windows machine?
You should try your program on Windows XP (or whatevr is the
lowest target system) after clean install without any updates.
AFAIK, Wordpad still uses VC++6.0 MFC dll, which uses VC++6.0 CRT