Re: Share .cpp and .h along projects

Tech-Archive recommends: Speed Up your PC by fixing your registry



COM is for binary compatibility. DLLs are binary objects
and it fits with them naturally. C++ classes are _not_ binary
entities and thus should _never_ be exported from DLLs -
period. It's a terrible deployment practice eclipising any bad
coding habits you might have! The proper way to export
C++ classes is using a static library. This signifies they are
part of your program, not part of a separate deployment unit.

--
=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD
email: agnickolov@xxxxxxxx
MVP VC FAQ: http://vcfaq.mvps.org
=====================================

"Doug Harrison [MVP]" <dsh@xxxxxxxx> wrote in message
news:ff61c3tt0otrfivah9ui5kmmjjh8o5lfui@xxxxxxxxxx
On Mon, 13 Aug 2007 12:26:43 -0500, "Ben Voigt [C++ MVP]"
<rbv@xxxxxxxxxxxxx> wrote:

It is incredibly fragile, non-standard behavior, that produces postings in
this newsgroup continually. The same behavior can be gotten in a robust,
compiler-independent way using COM-compatible binary interfaces. So why
use
__declspec(dllexport)?

Only __declspec(dllexport|dllimport) allows you to (mostly) use the
classes
as you would write them in normal C++. Using the __declspec should be
viewed as equivalent to static linking, and then you won't lament the fact
it isn't compiler-independent; after all, it was never intended to be. In
comparison, COM is a huge pain in the neck, and I wouldn't even consider
using it unless there was an actual need to use it.

--
Doug Harrison
Visual C++ MVP


.



Relevant Pages

  • Re: Compiling to a single exe file
    ... study of the DLLs required by a serious program, it used something like 27 Microsoft DLLs, ... If you are creating sockets in secondary threads and getting access errors, ... essay on UI threads on my MVP Tips site that explains how this is done. ... >to create sockets in secondary threads raise runtime access violations) ...
    (microsoft.public.vc.mfc)
  • Re: Share .cpp and .h along projects
    ... It's a terrible deployment practice eclipising any bad ... not part of a separate deployment unit. ... it's a fallacious argument to suggest that DLLs are "binary ... a binary protocol like COM (exclusively over non-binary objects like C++ ...
    (microsoft.public.vc.language)
  • Re: old MSVCRT.dll
    ... I've never encountered serious problems using dynamic linking. ... The only failure is for ... >> needed DLLs in the application directory. ... MVP Tips: http://www.flounder.com/mvp_tips.htm ...
    (microsoft.public.vc.mfc)
  • Re: Access is denied: SomeAssembly until I reboot
    ... [ASP.NET MVP http://mvp.support.microsoft.com/default.aspx] ... Got tidbits? ... > Sometimes if I put new .dlls onto my webserver I get this Configuration ... > Parser Error Message: Access is denied: 'webFunctions'. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Depends on Win64
    ... My app is definitely 64-bit and Depends is found in the ... there is no corresponding executable in the 64-bit executable directory of VS2005. ... Most of the DLLs it found were 32-bit DLLs, and I did not see offhand ... MVP Tips: http://www.flounder.com/mvp_tips.htm ...
    (microsoft.public.vc.mfc)