[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Splitting up DLLs (VC++)



PureBytes Links

Trading Reference Links

At 06:10 PM 12/4/99 , David Wieringa wrote:
>I've been developing code inside of DLL's for a couple of months now, and
>am looking to split my DLL up into a couple of DLLs.
>
>I'm developing in VC++ 6.0.  Although, I'm much more familiar in a Unix C++
>environment.
>
>I'd like to move all of my infrastructure and common objects into
>"common.dll" and then develop a seperate specialized DLL for each
>indepedent system.  Each of these "system" DLL's would require objects from
>common.dll.
>
>I've been tinkering today with splitting my workspace with one project into
>a workspace with multiple projects (Common, System1, System2, etc).
>
>Can anyone tell me how to get SystemX.dll to explicitely load Common.dll?
>
>So far, I've only loaded DLL's from EasyLanguage.
>
>Thanks,
>David
>
>david_wieringa@xxxxxxxx

There are two ways: so-called passive loading and dynamic or active loading.

When you create a DLL with VC++, it automatically creates an import library 
for that DLL. It you include that import library in a project, any 
externals in that project that are resolved by that import library force 
the corresponding DLL to be loaded when the project loads. That's the 
"passive" way. It's also the easier way for most situations.

The active way is to issue a Win32 API "LoadLibrary" call during execution. 
You then can get a pointer to any functions you want with another Win32 
call, "GetProcAddress." You unload the DLL with "FreeLibrary."

Allan