Extension dll w/o MFC possible?

Extension dll w/o MFC possible?

Post by dWx0cmFuZX » Wed, 02 Nov 2005 03:30:06


I guess the answer is no, and an equivalent way of achieving the same result
is to define and use the objects inside the dll, and then expose some global
functions as entry points which call on the objects: i.e., those objects can
only be used w/ dynamic linking inside that dll.

Is this correct? If not for Windows, is this correct for most other platforms?

Thanks.
 
 
 

Extension dll w/o MFC possible?

Post by Ulrich Eck » Wed, 02 Nov 2005 16:29:31


I'm not sure, but either you or me is having problems with the term
'extension DLL'...

I can only guess what you want, and that is to export a class from a DLL
which is perfectly feasible on MS Windows as on other platforms.

Uli

 
 
 

Extension dll w/o MFC possible?

Post by Arnaud Deb » Wed, 02 Nov 2005 18:58:03


I think you should make clear for everybody what you call an "extension DLL"
exactly....

Arnaud
MVP - VC
 
 
 

Extension dll w/o MFC possible?

Post by dWx0cmFuZX » Wed, 07 Dec 2005 06:26:02


Yes, that's what i want.
I didn't even give it a shot last time, because i interpreted a book i read
as saying extension dll must be an MFC dll.
The book is: Programming w/ Microsoft Visual C++ .NET
George Shepherd w/ David Kruglinski
6th edition

One section is titled (bad title, if what you say is true):
MFC DLLs: Extension vs. Regular

One paragraph says:
If you need a DLL that can be loaded by any Win32 programming env., you
should use a regular DLL. A big restriction here is that the regular DLL can
export only C-style functions. It can't export C++ classes, member functions,
or overloaded functions because every C++ compiler has its own method of
decorating names.
...

So, is this book incorrect? Can we really expose classes from a DLL w/o that
DLL being an MFC or ATL DLL? Is the answer the same for both Windows and
other major platforms?

Thanks.
 
 
 

Extension dll w/o MFC possible?

Post by dWx0cmFuZX » Wed, 07 Dec 2005 10:17:01


I think i already have made it clear: a dll that exposes C++ classes, so
that they could be used or extended outside the dll.
 
 
 

Extension dll w/o MFC possible?

Post by Carl Danie » Wed, 07 Dec 2005 12:18:07


The issue is that "extension DLL" is specifically an MFC term.

Yes, you certainly can make a DLL that exposes C++ classes to be re-used by
other DLLs/EXEs without using MFC.

Is there a specific problem you're encountering, or were you just looking
for a basic confirmation that it's a path worth persuing?

-cd
 
 
 

Extension dll w/o MFC possible?

Post by dWx0cmFuZX » Thu, 08 Dec 2005 00:37:03


OK, so if the dll defining the classes and the dlls or exes using it don't
have to be MFC, then i misunderstood the book: or maybe the book mislead me.
;)
But it is good to know for the future.

So far latter.
I suppose one of the advantages COM provides over using regular dlls
exposing classes then is in not loading the code until it is really needed,
and in unloading it when it's no longer needed. The 2nd one being interface
discovery and the 3rd one being aggregation...
But regular dlls have a big advantage in not being restricted by threading
models, i think.

Thanks all.
 
 
 

Extension dll w/o MFC possible?

Post by Tom Widmer » Thu, 08 Dec 2005 02:51:10


Another big advantage of COM vs a DLL exporting C++ classes is
portability - a COM dll is portable across Windows compilers (in various
languages) whilst a C++ class exporting DLL requires that the executable
using it be compiled with the same C++ compiler, and often the exact
same compiler version (e.g. a VC 6.0 compiled DLL usually won't work
with 7.1 exe).

Tom