NO

Author Topic: Smaller DLL  (Read 6708 times)

Larry

  • Guest
Smaller DLL
« 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...
Code: [Select]
// 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

  • Guest
Smaller DLL
« Reply #1 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

Timppa

  • Guest
Smaller DLL
« Reply #2 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

Anonymous

  • Guest
Smaller DLL
« Reply #3 on: December 08, 2004, 07:41:37 PM »
Quote
If 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.

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2115
Smaller DLL
« Reply #4 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");
May the source be with you

czerny

  • Guest
Re: Smaller DLL
« Reply #5 on: October 12, 2014, 03:30:26 PM »
LibCTiny4PC2.ZIP (19.76 kB - downloaded 142 times.)
Timo: Why have you set the -Zl Flag?

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2115
Re: Smaller DLL
« Reply #6 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.
May the source be with you

czerny

  • Guest
Re: Smaller DLL
« Reply #7 on: October 12, 2014, 04:18:39 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!