Re: crossing dll boundary ...
- From: David Wilkinson <no-reply@xxxxxxxxxxxx>
- Date: Thu, 11 Jan 2007 09:04:31 -0500
David Ching wrote:
I would guess you are static linking DllA to Dll main... this means you link Dll main with the DllA.lib import lib. This is called static linking. Dynamic linking if calling LoadLibrary/GetProcAddress instead. These don't work with exported functions. The only way AFAIK to use exported classes in another DLL is to statically link.
Anyway, since both DLL's are loaded into the same process, the class is instantiated in the process heap. I think this heap is used by all DLL's and doesn't "belong" to any one DLL. So the "m" member data is stored in the process heap.
The member functions are exported functions in DllA. They reside in DllA. If you call them from Dll main, it is an indirect call through a function pointer in the IAT (import address table) for the DLL. So technically, it is an extra level of indirection to call an exported function. Nowadays this level of indirection is considered insignificant. So I think you are fine the way it is.
David:
I think what you are talking about here is the distinction between "implicit linking" (using a static import library) and "explicit linking" (using ::LoadLibrary and ::GetProcAddress).
Your terminology of "static linking" versus "dynamic linking" is confusing, IMHO. Firstly, a DLL (as its name implies) is always "dynamically linked", in the sense that the actual code is only linked at run time. Secondly, the terms "static" and "dynamic" linking are commonly used to indicate the way in which the CRT/MFC/C++ libraries are linked, which is another issue entirely.
David Wilkinson
.
- Follow-Ups:
- Re: crossing dll boundary ...
- From: David Ching
- Re: crossing dll boundary ...
- References:
- crossing dll boundary ...
- From: JD
- Re: crossing dll boundary ...
- From: robert
- Re: crossing dll boundary ...
- From: JD
- Re: crossing dll boundary ...
- From: David Ching
- crossing dll boundary ...
- Prev by Date: Re: Does CWnd::SetIcon copy an icon resource ?
- Next by Date: Batch file and MFC
- Previous by thread: Re: crossing dll boundary ...
- Next by thread: Re: crossing dll boundary ...
- Index(es):
Relevant Pages
|