Pelles C forum

Pelles C => General discussions => Topic started by: Larry on December 07, 2004, 08:15:33 PM

Title: Smaller DLL
Post by: Larry on December 07, 2004, 08:15:33 PM
This is just a little ditty I use to keep my Windows dll smaller... I plop this code in somewhere...// This is to prevent the CRT from loading, thus making this a smaller
//  and faster dll.
extern BOOL __stdcall _DllMainCRTStartup( HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
   Sleep(0);
   return DllMain( hinstDLL, fdwReason, lpvReserved );
}
Title: Smaller DLL
Post by: Larry on December 07, 2004, 08:17:48 PM
I really am not sure why the Sleep(0) is there... I don't remember...

anyway, it knocks my 12k dll down to 6k
Title: Smaller DLL
Post by: Timppa on December 08, 2004, 09:11:08 AM
If You just use Win32 API and want to drop CRT, check Matt Pietrek's libctiny.lib
Title: Smaller DLL
Post by: Anonymous on December 08, 2004, 07:41:37 PM
QuoteIf You just use Win32 API and want to drop CRT, check Matt Pietrek's libctiny.lib
I am interested... but I link with libctiny and get errors...cannot find libc.lib... I suppose there is complicated stuff involved... I will stay tuned...

Lar.
Title: Smaller DLL
Post by: TimoVJL on December 09, 2004, 06:20:42 AM
Test with this prebuild.

You can also use this in one file project:

#pragma nodefaultlib
#pragma comment(lib, "libctiny.lib");
Title: Re: Smaller DLL
Post by: czerny on October 12, 2014, 03:30:26 PM
Quote from: TimoVJL on December 09, 2004, 06:20:42 AM
LibCTiny4PC2.ZIP (19.76 kB - downloaded 142 times.)
Timo: Why have you set the -Zl Flag?
Title: Re: Smaller DLL
Post by: TimoVJL on October 12, 2014, 03:57:42 PM
Quote/Zl Prevents linker directives from being emitted to the object file.
this way CRT-library is avoided.
Title: Re: Smaller DLL
Post by: czerny on October 12, 2014, 04:18:39 PM
Quote from: TimoVJL on October 12, 2014, 03:57:42 PM
Quote/Zl Prevents linker directives from being emitted to the object file.
this way CRT-library is avoided.
Ahhh!

This is a translation error!

In the german IDE -Zl Standardbibliothek in Objektdatei übermitteln

that means the opposite!