DLL design question

B

Bit byte

I have an application which consists of several (approx 40 C/C++ dlls).
I want to provide a C (Win32 Dll) API to these Dlls. However, I
want to partion the API at a different level of abstraction. I need som
advice on the best practise on doing this. the following may help
explain the situation better:

'Core' Low level C/C++ DLLs
=============================
foo_1.dll
foo_2.dll
foo_3.dll
foo_4.dll
foo_5.dll
foo_6.dll
foo_7.dll
foo_8.dll
foo_9.dll
foo_10.dll
....


Higher level 'C' Win32 Dll public 'C' Interface
================================================
foobar_1.dll (uses functions exported in foo_1.dll, foo_3.dll and
foo_8.dll)
foobar_2.dll (uses functions exported in foo_7.dll and foo_8.dll)
foobar_3.dll (uses functions exported in foo_3.dll, foo_4.dll and
foo_5.dll)

.... etc

I know I'll have to use DllLoad and GetProcAddress() etc (at least I
think I know that is ONE option), but I would be grateful if someone
could provide more details on the best way to do this (i.e. expose a
higher level abstraction C DLL)
 
W

William DePalo [MVP VC++]

Bit byte said:
'Core' Low level C/C++ DLLs
=============================
foo_1.dll
foo_2.dll
foo_3.dll
foo_4.dll
foo_5.dll
foo_6.dll
foo_7.dll
foo_8.dll
foo_9.dll
foo_10.dll
...


Higher level 'C' Win32 Dll public 'C' Interface
================================================
foobar_1.dll (uses functions exported in foo_1.dll, foo_3.dll and
foo_8.dll)
foobar_2.dll (uses functions exported in foo_7.dll and foo_8.dll)
foobar_3.dll (uses functions exported in foo_3.dll, foo_4.dll and
foo_5.dll)

... etc

I know I'll have to use DllLoad and GetProcAddress() etc (at least I think
I know that is ONE option), but I would be grateful if someone could
provide more details on the best way to do this (i.e. expose a higher
level abstraction C DLL)

Forget for a minute the implementation detail that your functions are in
libraries called DLLs. Just think in terms of functions and libraries. If
your 'application' that resides in 'foobar_1.dll' calls a function in
another library 'foo_1.dll', all that you need to do is to add the library
to the linker input for your application so that the references may be
resolved.

Where DLLs are concerned, the 'libraries' used to build are called 'import
libraries'. Using the IDE, the linker creates them automatically for you.

So, build your low level projects. Then create projects for your higher
level interfaces. Add the relevant low level import libraries to those
projects.

Regards,
Will
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top