Re: crossing dll boundary ...

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance




"JD" <jdt_young@xxxxxxxxx> wrote in message
news:e1VVWWPNHHA.5016@xxxxxxxxxxxxxxxxxxxxxxx
Hello Robert,

Thank you for your answer. My case is dynamic linking. I guess it won't
may a difference. The compiler should be smart enough to place the member
variables in dll Main during the compile time. But during the run time,
if any of the class's functions calls another function in dll A, execution
still needs to jump into the dll A's image. Is that right?


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 (MVP)


.



Relevant Pages

  • Re: crossing dll boundary ...
    ... Dynamic linking if calling LoadLibrary/GetProcAddress instead. ... The only way AFAIK to use exported classes in another DLL is to statically link. ... The member functions are exported functions in DllA. ... Your terminology of "static linking" versus "dynamic linking" is confusing, ...
    (microsoft.public.vc.mfc)
  • Re: HLA stdlib v2.3 is now available
    ... dynamic linking on modern operating systems to save on resources. ... the whole thing into a DLL and then *any* assembler ... all the apps), but how many assembly apps does the average person run ... statically link in all the library code you use so your application is ...
    (alt.lang.asm)
  • Re: Dynamic DLL Loading or Static ?
    ... A DLL is dynamic linked always: ... terms are load-time dynamic linking and run-time dynamic linking. ... > initialize this DLL and I'm loading it dynamically. ... This is the default value for WinXP SP1 and WinSrv03. ...
    (borland.public.delphi.nativeapi)
  • Re: c code reusability
    ... disk space and computer memory are relatively cheap. ... of dynamic linking, ... The average size of a loaded DLL is 558 KB. ...
    (comp.lang.c)
  • Re: Problem with reading an int with operator>>
    ... Yes, but as always with dynamic linking, this is no real advantage if I have to ship the DLL's myself. ... this advantage if I could keep all my Standard Library in the headers where it could be easily updated. ... Is it just a matter of removing all the "#ifdef _DLL" sections? ... an impediment to Microsoft updating the standard library when improvements have been found. ...
    (microsoft.public.vc.stl)