Einzelnen Beitrag anzeigen

OregonGhost

Registriert seit: 8. Jun 2002
Ort: Lübeck
1.216 Beiträge
 
Delphi 3 Professional
 
#10

Re: Größe C++ dll ändert sich nicht

  Alt 21. Nov 2006, 11:49
Ein Bekannter von mir ist ganz begeistert vom Borland C++-Builder X, ich weiß nicht, ob es den noch kostenlos gibt.

Wenn du bei Visual-C++ bleiben willst:

Die CRT kann meines Wissens auch einfach statisch eingebunden werden (also so, wie auch im Normalfall die VCL in Delphi eingebunden wird). Eine von den 200 Optionen ist dafür zuständig, das müsste eigentlich Code Generation->Runtime Library sein. Da man sogar der ATL sagen kann, dass sie die CRT statisch linken soll, sollte das eigentlich hierüber möglich sein.
Ja, du hast recht, grundsätzlich ist der Unterschied zwischen Release und Debug, dass du einfach zwei verschiedene Sets von Einstellungen hast. Wie du aber schon festgestellt hast, sind es wirklich eine Menge Einstellungen, und Release entfernt eben alle Debug-Informationen, aktiviert Optimierungen usw.
DLLs und Anwendungen brauchen auch normalerweise eine Menge unterschiedlicher Einstellungen. Die beiden Sets von Einstellungen werden beim Erstellen des Projekts entsprechend voreingestellt.

Edit:
Auszug aus dem von dir verlinkten Artikel auf codeproject.com:
Zitat:
The final option is to statically link your executable to the CRT (by the way, this is how the bootstrapper is able to run without the CRTs). To statically link to the executables, go to the Project -> Project Properties -> Configuration Properties -> C/C++ -> Code Generation -> Runtime Library (change from "Multi-Threaded DLL" to "Multi-Threaded").

If you're careful enough, you can even get the application to run on Windows NT! The pieces of the CRT that require InterlockedCompareExchange and GetLongPathNameW get discarded out of your final executable, and thus your app can run on Windows NT. In order for this to happen, you have to be careful about which C functions you call (no iostream, no locale, no algorithm), and you'll probably have to upgrade to the latest service pack for Windows NT (plus all post service pack patches).

Using this method is not much better than rebuilding the CRTs. Once again, if your application consists of several DLLs where each DLL expects STL/CRT parameters, you will get serious bugs until you rebuild by dynamically linking the CRT.

And if Microsoft issues a fix for their routines, and you use this method, you become solely responsible for fixing both yours and Microsoft's bugs.
Der Artikel beschreibt halt auch, wie man die CRT-DLLs sauber installiert kriegt und so weiter, für ein "ernsthaftes" großes Projekt ist das sicherlich auch nicht das schlechteste.
Oregon Ghost
---
Wenn NULL besonders groß ist, ist es fast schon wie ein bisschen eins.
  Mit Zitat antworten Zitat