News:

Download Pelles C here: http://www.smorgasbordet.com/pellesc/

Main Menu

Smaller DLL

Started by Larry, December 07, 2004, 08:15:33 PM

Previous topic - Next topic

Larry

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 );
}

Larry

I really am not sure why the Sleep(0) is there... I don't remember...

anyway, it knocks my 12k dll down to 6k

Timppa

If You just use Win32 API and want to drop CRT, check Matt Pietrek's libctiny.lib

Anonymous

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.

TimoVJL

Test with this prebuild.

You can also use this in one file project:

#pragma nodefaultlib
#pragma comment(lib, "libctiny.lib");
May the source be with you

czerny

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?

TimoVJL

Quote/Zl Prevents linker directives from being emitted to the object file.
this way CRT-library is avoided.
May the source be with you

czerny

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!