mfc >> The Ultimate (DLL) Header File

by Fenster » Wed, 26 Nov 2003 15:47:03 GMT


Apologies to Mr Newcomer for stealing his essay title but I've just been
reading the essay (www.flounder.com/ultimateheaderfile.htm), looking for
inspiration.

What I have is a class for interfacing with a device driver built into a
static library (.lib). One of my customers is using a Borland compiler
(but let's not go there) and the differences between OMF and COFF are
causing us both grief. He is of the opinion that if I could produce a
DLL all (or at least some) of his problems would go away.

So what I'm trying to do is wrap my class up inside a DLL, ideally
having to duplicate as little of the original library header files as
possible.

In my DLL at the moment, and it's a lousy long-term solution, is a new
class based on the original class. I've cut and pasted the declarations
of the original public methods and the definitions of these call the
base class and nothing more.

I'd appreciate any ideas or suggestions that allow me to stop all this
duplication because I know that when the original class gets extended
there's going to be a drop off and I'll get caught.

Cheers.

--
Fenster


Similar Threads

1. using a DLL function in a header file

2. Accessing header files from DLL

readytoride39 wrote:
> ...I have
> several datatypes, defined attributes, and structures
> defined in the header files that I need to use in the
> main exe. These uses are used for typecasting among other
> things.  I can not simply move these uses over into the
> dll because then I would have the exact opposite problem.
>
> My question is - Is there a way to export these
> structures, datatypes, and defined attributes from the
> dll so that 1)I can compile properly and 2) use them in
> the exe and the dll when running the application?

You cannot export/import types, since they don't form 
executable code. That's why you cannot compile .H files - 
there's nothing to compile, because process of compilation 
is translating textual code into machine binary code. Type 
declarations are thin air, abstraction for humans. Only when 
instance of some type is created, then and only then there 
is some command for CPU to execute.

If you have common types for EXE and DLL, then extract them 
into shared header and use this header both in DLL and EXE. 
Take platform SDK as example. You have headers with 
types/functions declarations. Actual implementation is 
inside DLL's. Both OS DLL's and your program use the same 
declaration.

HTH
Alex 


3. LIB's, DLL's & header files

4. Cannot open include file:problem with Dll header

i am trying to use dll for my project..i have include "test.lib" in
link tab in project
And now i want to use function of dll by including "test.h" file in
stdfx.h.
but while compile it gives error .
 Cannot open include file:  Cannot open include file: `test.h` no such
file or directory
Any help........how to solve this problem

5. Recreate IDL and C++ Header file from .DLL - Windows CE

6. system restore DID delete lots of my C# code files on Vista Ultimate

7. Auto-generating C header file from C++ header?

8. excluse header file from pre-compiled header

Hi,

I have my project optimized with pre-compiled headers. Now I add
WindowsMedia to the project and I get a message that pre-compiled headers
cannot be created because there is initialized data in header. This is in
wmsbuffer.h, the lines with EXTERN_GUID(IID_INSSBuffer etc.

It's rather complicated to solve this so is there a way to exclude specific
header files from the pre-compiled header?

My pre-compiled header structure is setup like this:

I have one header file that includes all necessary class and form header
files. After the inclusion of this main-header file is a hdrstop pragma. The
included headers files include several other header files etc. At one time,
wmsbuffer.h is included so it becomes part of the pre-compiled header.

Wim