• Welcome to Powerbasic Museum 2020-B.
 

News:

Forum in repository mode. No new members allowed.

Main Menu

VS2010 - C++ EXE size reduction, how?

Started by Patrice Terrier, February 07, 2011, 10:45:58 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Florent Heyworth

#15
Quote from: Patrice Terrier on February 08, 2011, 10:23:54 PM
Florent

Does it work by you?

I mean, when you copy the Release 26 Kb EXE into the Debug folder (where there are the resources) do you see the skinned interface with the Naavi?

...


Hi Patrice

yes it works fine - I tested both yesterday on my Windows 7 PC - and I get the HUD, can load graphics, move and rotate the images... I downloaded the HUD demo project from your website and used the resources in that Debug folder - could it be that you are testing it with other versions of these resources/DLLs?

Cheers. Florent

Florent Heyworth

Hi Patrice

one more thought - the project depends on external DLLs - do you have MSVCP100.dll and MSVCR100.dll (part of the redistributable C++ 2010 redistributable package) in your paths? What happens when you run the executable?

Cheers, Florent

Florent Heyworth

#17
Hi Patrice

here's a dependency profile log from running the hudplus EXE. Download depends.exe (http://www.dependencywalker.com) and compare the results on your system.

Cheers, Florent

Patrice Terrier

#18
Florent,

I run it on Seven 64-bit.

I shall check about MSVCP100.dll and MSVCR100.dll being into the path, but what i want, is to produce the smallest EXE with no external dependencies, except the standard Win32 OS DLLs.

...

Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Florent Heyworth

Hi Patrice

I also run it on Win 7 64-bit :) It's failing because it can't find the redistributable C++ dependencies. Now here's where the tradeoff happens: either you keep the EXE size small and depend on external runtime or you statically link against those dependencies. Since the project already needs WinLift, GDImage, etc I 'm not sure what you mean with no external dependencies... There's no such thing as no dependency...

The problem is that MSVCRT.lib automatically references the MSVC*100.dlls in Visual Studio 2010 instead of linking against the system's default msvcrt.dll. The basic problem is you need to link against the Runtime library - either statically with the /MT flag (which naturally bumps the EXE size sizably upwards) or dynamically with the /MD flag. Using /MD however requires that the MSVC100 runtine redistributable be installed....

You can start by getting rid of all standard C++ library headers (such as ios, string, etc.) - a lot of work which in my opinion is not worth it - C++ programmers won't want to jump through hoops just to keep the size down. How about simply using static runtime linking (/MT) and then using a compressor to reduce the EXE size. Having your cake and eating it is a lot of work :)

Cheers, Florent

Patrice Terrier

Florent,

Here is the dependency profile log from running your 26 Kb HUDplus.exe on my computer:


Warning: At least one delay-load dependency module was not found.
Warning: At least one module has an unresolved import due to a missing export function in a delay-load dependent module.

--------------------------------------------------------------------------------
Starting profile on 09/02/2011 at 08:43:56

Operating System: Microsoft Windows NT/2000/XP/2003/Vista based Home Premium (64-bit), version 6.01.7600
Program Executable: i:\solutions\hudplusc++\debug\HUDPLUS.EXE
Program Arguments:
Starting Directory: I:\Solutions\HUDplusC++\Debug\
Search Path: C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;c:\Outils;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Program Files (x86)\CyberLink\Power2Go;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Common Files\Acronis\SnapAPI\;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\;D:\BCX\Bin;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files (x86)\IDM Computer Solutions\UltraEdit\;C:\Program Files (x86)\IDM Computer Solutions\UltraCompare\

Options Selected:
     Simulate ShellExecute by inserting any App Paths directories into the PATH environment variable.
     Log DllMain calls for process attach and process detach messages.
     Hook the process to gather more detailed dependency information.
     Log LoadLibrary function calls.
     Log GetProcAddress function calls.
     Log debug output messages.
     Automatically open and profile child processes.
--------------------------------------------------------------------------------

Started "HUDPLUS.EXE" (process 0x118C) at address 0x002D0000.  Successfully hooked module.
Loaded "NTDLL.DLL" at address 0x76F10000.  Successfully hooked module.
Loaded "KERNEL32.DLL" at address 0x751B0000.  Successfully hooked module.
Loaded "KERNELBASE.DLL" at address 0x760E0000.  Successfully hooked module.
DllMain(0x760E0000, DLL_PROCESS_ATTACH, 0x00000000) in "KERNELBASE.DLL" called.
DllMain(0x760E0000, DLL_PROCESS_ATTACH, 0x00000000) in "KERNELBASE.DLL" returned 1 (0x1).
DllMain(0x751B0000, DLL_PROCESS_ATTACH, 0x00000000) in "KERNEL32.DLL" called.
DllMain(0x751B0000, DLL_PROCESS_ATTACH, 0x00000000) in "KERNEL32.DLL" returned 1 (0x1).
Injected "DEPENDS.DLL" at address 0x08370000.
DllMain(0x08370000, DLL_PROCESS_ATTACH, 0x00000000) in "DEPENDS.DLL" called.
DllMain(0x08370000, DLL_PROCESS_ATTACH, 0x00000000) in "DEPENDS.DLL" returned 1 (0x1).
Loaded "USER32.DLL" at address 0x76690000.  Successfully hooked module.
Loaded "GDI32.DLL" at address 0x74B70000.  Successfully hooked module.
Loaded "LPK.DLL" at address 0x76B00000.  Successfully hooked module.
Loaded "USP10.DLL" at address 0x765F0000.  Successfully hooked module.
Loaded "MSVCRT.DLL" at address 0x75340000.  Successfully hooked module.
Loaded "ADVAPI32.DLL" at address 0x753F0000.  Successfully hooked module.
Loaded "SECHOST.DLL" at address 0x74FF0000.  Successfully hooked module.
Loaded "RPCRT4.DLL" at address 0x76130000.  Successfully hooked module.
Loaded "SSPICLI.DLL" at address 0x74A80000.  Successfully hooked module.
Loaded "CRYPTBASE.DLL" at address 0x74A70000.  Successfully hooked module.
Loaded "SHELL32.DLL" at address 0x75490000.  Successfully hooked module.
Loaded "SHLWAPI.DLL" at address 0x76790000.  Successfully hooked module.
Loaded "MSVCP100.DLL" at address 0x743B0000.  Successfully hooked module.
Loaded "MSVCR100.DLL" at address 0x6C2F0000.  Successfully hooked module.
Entrypoint reached. All implicit modules have been loaded.
DllMain(0x75340000, DLL_PROCESS_ATTACH, 0x0023FAA0) in "MSVCRT.DLL" called.
DllMain(0x75340000, DLL_PROCESS_ATTACH, 0x0023FAA0) in "MSVCRT.DLL" returned 1 (0x1).
DllMain(0x765F0000, DLL_PROCESS_ATTACH, 0x0023FAA0) in "USP10.DLL" called.
LoadLibraryA("gdi32.dll") called from "USP10.DLL" at address 0x76606890.
LoadLibraryA("gdi32.dll") returned 0x74B70000.
GetProcAddress(0x74B70000 [GDI32.DLL], "GetCharABCWidthsI") called from "USP10.DLL" at address 0x766068C5 and returned 0x74B8AFF8.
DllMain(0x765F0000, DLL_PROCESS_ATTACH, 0x0023FAA0) in "USP10.DLL" returned 1 (0x1).
DllMain(0x76B00000, DLL_PROCESS_ATTACH, 0x0023FAA0) in "LPK.DLL" called.
DllMain(0x76B00000, DLL_PROCESS_ATTACH, 0x0023FAA0) in "LPK.DLL" returned 1 (0x1).
DllMain(0x74B70000, DLL_PROCESS_ATTACH, 0x0023FAA0) in "GDI32.DLL" called.
DllMain(0x74B70000, DLL_PROCESS_ATTACH, 0x0023FAA0) in "GDI32.DLL" returned 1 (0x1).
DllMain(0x74A70000, DLL_PROCESS_ATTACH, 0x0023FAA0) in "CRYPTBASE.DLL" called.
DllMain(0x74A70000, DLL_PROCESS_ATTACH, 0x0023FAA0) in "CRYPTBASE.DLL" returned 1 (0x1).
DllMain(0x74A80000, DLL_PROCESS_ATTACH, 0x0023FAA0) in "SSPICLI.DLL" called.
DllMain(0x74A80000, DLL_PROCESS_ATTACH, 0x0023FAA0) in "SSPICLI.DLL" returned 1 (0x1).
DllMain(0x76130000, DLL_PROCESS_ATTACH, 0x0023FAA0) in "RPCRT4.DLL" called.
DllMain(0x76130000, DLL_PROCESS_ATTACH, 0x0023FAA0) in "RPCRT4.DLL" returned 1981064961 (0x7614A701).
DllMain(0x74FF0000, DLL_PROCESS_ATTACH, 0x0023FAA0) in "SECHOST.DLL" called.
DllMain(0x74FF0000, DLL_PROCESS_ATTACH, 0x0023FAA0) in "SECHOST.DLL" returned 1 (0x1).
DllMain(0x753F0000, DLL_PROCESS_ATTACH, 0x0023FAA0) in "ADVAPI32.DLL" called.
DllMain(0x753F0000, DLL_PROCESS_ATTACH, 0x0023FAA0) in "ADVAPI32.DLL" returned 1 (0x1).
DllMain(0x76690000, DLL_PROCESS_ATTACH, 0x0023FAA0) in "USER32.DLL" called.
LoadLibraryW("C:\Windows\system32\IMM32.DLL") called from "USER32.DLL" at address 0x766AC2B5.
Loaded "IMM32.DLL" at address 0x750D0000.  Successfully hooked module.
Loaded "MSCTF.DLL" at address 0x74DD0000.  Successfully hooked module.
DllMain(0x74DD0000, DLL_PROCESS_ATTACH, 0x00000000) in "MSCTF.DLL" called.
DllMain(0x74DD0000, DLL_PROCESS_ATTACH, 0x00000000) in "MSCTF.DLL" returned 1 (0x1).
DllMain(0x750D0000, DLL_PROCESS_ATTACH, 0x00000000) in "IMM32.DLL" called.
GetProcAddress(0x750D0000 [IMM32.DLL], "ImmWINNLSEnableIME") called from "USER32.DLL" at address 0x766AB776 and returned 0x750EF637.
GetProcAddress(0x750D0000 [IMM32.DLL], "ImmWINNLSGetEnableStatus") called from "USER32.DLL" at address 0x766AB78B and returned 0x750EF65E.
GetProcAddress(0x750D0000 [IMM32.DLL], "ImmSendIMEMessageExW") called from "USER32.DLL" at address 0x766AB7A0 and returned 0x750EF8EC.
GetProcAddress(0x750D0000 [IMM32.DLL], "ImmSendIMEMessageExA") called from "USER32.DLL" at address 0x766AB7B5 and returned 0x750EF907.
GetProcAddress(0x750D0000 [IMM32.DLL], "ImmIMPGetIMEW") called from "USER32.DLL" at address 0x766AB7CA and returned 0x750EFB65.
GetProcAddress(0x750D0000 [IMM32.DLL], "ImmIMPGetIMEA") called from "USER32.DLL" at address 0x766AB7DF and returned 0x750EFB99.
GetProcAddress(0x750D0000 [IMM32.DLL], "ImmIMPQueryIMEW") called from "USER32.DLL" at address 0x766AB7F4 and returned 0x750EF9CA.
GetProcAddress(0x750D0000 [IMM32.DLL], "ImmIMPQueryIMEA") called from "USER32.DLL" at address 0x766AB809 and returned 0x750EFAD6.
GetProcAddress(0x750D0000 [IMM32.DLL], "ImmIMPSetIMEW") called from "USER32.DLL" at address 0x766AB81E and returned 0x750EF746.
GetProcAddress(0x750D0000 [IMM32.DLL], "ImmIMPSetIMEA") called from "USER32.DLL" at address 0x766AB833 and returned 0x750EF86E.
GetProcAddress(0x750D0000 [IMM32.DLL], "ImmAssociateContext") called from "USER32.DLL" at address 0x766AB848 and returned 0x750E3691.
GetProcAddress(0x750D0000 [IMM32.DLL], "ImmEscapeA") called from "USER32.DLL" at address 0x766AB85D and returned 0x750E9327.
GetProcAddress(0x750D0000 [IMM32.DLL], "ImmEscapeW") called from "USER32.DLL" at address 0x766AB872 and returned 0x750E95A9.
GetProcAddress(0x750D0000 [IMM32.DLL], "ImmGetCompositionStringA") called from "USER32.DLL" at address 0x766AB887 and returned 0x750E7A37.
GetProcAddress(0x750D0000 [IMM32.DLL], "ImmGetCompositionStringW") called from "USER32.DLL" at address 0x766AB89C and returned 0x750E420D.
GetProcAddress(0x750D0000 [IMM32.DLL], "ImmGetCompositionWindow") called from "USER32.DLL" at address 0x766AB8B1 and returned 0x750E2DF9.
GetProcAddress(0x750D0000 [IMM32.DLL], "ImmGetContext") called from "USER32.DLL" at address 0x766AB8C6 and returned 0x750E2004.
GetProcAddress(0x750D0000 [IMM32.DLL], "ImmGetDefaultIMEWnd") called from "USER32.DLL" at address 0x766AB8DB and returned 0x750E1F1D.
GetProcAddress(0x750D0000 [IMM32.DLL], "ImmIsIME") called from "USER32.DLL" at address 0x766AB8F0 and returned 0x750E2FC8.
GetProcAddress(0x750D0000 [IMM32.DLL], "ImmReleaseContext") called from "USER32.DLL" at address 0x766AB905 and returned 0x750E2122.
GetProcAddress(0x750D0000 [IMM32.DLL], "ImmRegisterClient") called from "USER32.DLL" at address 0x766AB91A and returned 0x750E135E.
GetProcAddress(0x750D0000 [IMM32.DLL], "ImmGetCompositionFontW") called from "USER32.DLL" at address 0x766AB92F and returned 0x750E68C8.
GetProcAddress(0x750D0000 [IMM32.DLL], "ImmGetCompositionFontA") called from "USER32.DLL" at address 0x766AB944 and returned 0x750E682C.
GetProcAddress(0x750D0000 [IMM32.DLL], "ImmSetCompositionFontW") called from "USER32.DLL" at address 0x766AB959 and returned 0x750E3966.
GetProcAddress(0x750D0000 [IMM32.DLL], "ImmSetCompositionFontA") called from "USER32.DLL" at address 0x766AB96E and returned 0x750E6964.
GetProcAddress(0x750D0000 [IMM32.DLL], "ImmSetCompositionWindow") called from "USER32.DLL" at address 0x766AB983 and returned 0x750E38D8.
GetProcAddress(0x750D0000 [IMM32.DLL], "ImmNotifyIME") called from "USER32.DLL" at address 0x766AB998 and returned 0x750E3BB9.
GetProcAddress(0x750D0000 [IMM32.DLL], "ImmLockIMC") called from "USER32.DLL" at address 0x766AB9AD and returned 0x750E1DDD.
GetProcAddress(0x750D0000 [IMM32.DLL], "ImmUnlockIMC") called from "USER32.DLL" at address 0x766AB9C2 and returned 0x750E1D89.
GetProcAddress(0x750D0000 [IMM32.DLL], "ImmLoadIME") called from "USER32.DLL" at address 0x766AB9D7 and returned 0x750E18F9.
GetProcAddress(0x750D0000 [IMM32.DLL], "ImmSetOpenStatus") called from "USER32.DLL" at address 0x766AB9EC and returned 0x750E3FF4.
GetProcAddress(0x750D0000 [IMM32.DLL], "ImmFreeLayout") called from "USER32.DLL" at address 0x766ABA01 and returned 0x750E97EF.
GetProcAddress(0x750D0000 [IMM32.DLL], "ImmActivateLayout") called from "USER32.DLL" at address 0x766ABA16 and returned 0x750E8DF5.
GetProcAddress(0x750D0000 [IMM32.DLL], "ImmGetCandidateWindow") called from "USER32.DLL" at address 0x766ABA2B and returned 0x750E2E3C.
GetProcAddress(0x750D0000 [IMM32.DLL], "ImmSetCandidateWindow") called from "USER32.DLL" at address 0x766ABA40 and returned 0x750E3E03.
GetProcAddress(0x750D0000 [IMM32.DLL], "ImmConfigureIMEW") called from "USER32.DLL" at address 0x766ABA55 and returned 0x750E913F.
GetProcAddress(0x750D0000 [IMM32.DLL], "ImmGetConversionStatus") called from "USER32.DLL" at address 0x766ABA6A and returned 0x750E2469.
GetProcAddress(0x750D0000 [IMM32.DLL], "ImmSetConversionStatus") called from "USER32.DLL" at address 0x766ABA7F and returned 0x750E3EE7.
GetProcAddress(0x750D0000 [IMM32.DLL], "ImmSetStatusWindowPos") called from "USER32.DLL" at address 0x766ABA94 and returned 0x750E6A7C.
GetProcAddress(0x750D0000 [IMM32.DLL], "ImmGetImeInfoEx") called from "USER32.DLL" at address 0x766ABAA9 and returned 0x750E14F0.
GetProcAddress(0x750D0000 [IMM32.DLL], "ImmLockImeDpi") called from "USER32.DLL" at address 0x766ABABE and returned 0x750E1FA5.
GetProcAddress(0x750D0000 [IMM32.DLL], "ImmUnlockImeDpi") called from "USER32.DLL" at address 0x766ABAD3 and returned 0x750E1F58.
GetProcAddress(0x750D0000 [IMM32.DLL], "ImmGetOpenStatus") called from "USER32.DLL" at address 0x766ABAE8 and returned 0x750E3DD0.
GetProcAddress(0x750D0000 [IMM32.DLL], "ImmSetActiveContext") called from "USER32.DLL" at address 0x766ABAFD and returned 0x750E21D1.
GetProcAddress(0x750D0000 [IMM32.DLL], "ImmTranslateMessage") called from "USER32.DLL" at address 0x766ABB12 and returned 0x750EF27F.
GetProcAddress(0x750D0000 [IMM32.DLL], "ImmLoadLayout") called from "USER32.DLL" at address 0x766ABB27 and returned 0x750E9E79.
GetProcAddress(0x750D0000 [IMM32.DLL], "ImmProcessKey") called from "USER32.DLL" at address 0x766ABB3C and returned 0x750E3A6A.
GetProcAddress(0x750D0000 [IMM32.DLL], "ImmPutImeMenuItemsIntoMappedFile") called from "USER32.DLL" at address 0x766ABB51 and returned 0x750F4E96.
GetProcAddress(0x750D0000 [IMM32.DLL], "ImmGetProperty") called from "USER32.DLL" at address 0x766ABB66 and returned 0x750E3C1B.
GetProcAddress(0x750D0000 [IMM32.DLL], "ImmSetCompositionStringA") called from "USER32.DLL" at address 0x766ABB7B and returned 0x750E83C2.
GetProcAddress(0x750D0000 [IMM32.DLL], "ImmSetCompositionStringW") called from "USER32.DLL" at address 0x766ABB90 and returned 0x750E83E9.
GetProcAddress(0x750D0000 [IMM32.DLL], "ImmEnumInputContext") called from "USER32.DLL" at address 0x766ABBA5 and returned 0x750E320A.
GetProcAddress(0x750D0000 [IMM32.DLL], "ImmSystemHandler") called from "USER32.DLL" at address 0x766ABBBA and returned 0x750EB1CF.
GetProcAddress(0x750D0000 [IMM32.DLL], "CtfImmTIMActivate") called from "USER32.DLL" at address 0x766ABBCB and returned 0x750E1807.
GetProcAddress(0x750D0000 [IMM32.DLL], "CtfImmRestoreToolbarWnd") called from "USER32.DLL" at address 0x766ABBDC and returned 0x750F5114.
GetProcAddress(0x750D0000 [IMM32.DLL], "CtfImmHideToolbarWnd") called from "USER32.DLL" at address 0x766ABBED and returned 0x750F514B.
GetProcAddress(0x750D0000 [IMM32.DLL], "CtfImmDispatchDefImeMessage") called from "USER32.DLL" at address 0x766ABBFE and returned 0x750E1611.
GetProcAddress(0x750D0000 [IMM32.DLL], "CtfImmNotify") called from "USER32.DLL" at address 0x766ABC0F and returned 0x750E1346.
GetProcAddress(0x750D0000 [IMM32.DLL], "CtfImmSetDefaultRemoteKeyboardLayout") called from "USER32.DLL" at address 0x766ABC20 and returned 0x750F53CC.
GetProcAddress(0x750D0000 [IMM32.DLL], "CtfImmGetCompatibleKeyboardLayout") called from "USER32.DLL" at address 0x766ABC31 and returned 0x750F53DC.
DllMain(0x750D0000, DLL_PROCESS_ATTACH, 0x00000000) in "IMM32.DLL" returned 1 (0x1).
LoadLibraryW("C:\Windows\system32\IMM32.DLL") returned 0x750D0000.
GetProcAddress(0x76B00000 [LPK.DLL], "LpkTabbedTextOut") called from "GDI32.DLL" at address 0x74B86970 and returned 0x76B048A0.
GetProcAddress(0x76B00000 [LPK.DLL], "LpkPSMTextOut") called from "GDI32.DLL" at address 0x74B8697B and returned 0x76B01430.
GetProcAddress(0x76B00000 [LPK.DLL], "LpkDrawTextEx") called from "GDI32.DLL" at address 0x74B86986 and returned 0x76B013D0.
GetProcAddress(0x76B00000 [LPK.DLL], "LpkEditControl") called from "GDI32.DLL" at address 0x74B86991 and returned 0x76B07000.
DllMain(0x76690000, DLL_PROCESS_ATTACH, 0x0023FAA0) in "USER32.DLL" returned 1 (0x1).
DllMain(0x76790000, DLL_PROCESS_ATTACH, 0x0023FAA0) in "SHLWAPI.DLL" called.
DllMain(0x76790000, DLL_PROCESS_ATTACH, 0x0023FAA0) in "SHLWAPI.DLL" returned 1 (0x1).
DllMain(0x75490000, DLL_PROCESS_ATTACH, 0x0023FAA0) in "SHELL32.DLL" called.
DllMain(0x75490000, DLL_PROCESS_ATTACH, 0x0023FAA0) in "SHELL32.DLL" returned 1 (0x1).
DllMain(0x6C2F0000, DLL_PROCESS_ATTACH, 0x0023FAA0) in "MSVCR100.DLL" called.
GetProcAddress(0x751B0000 [KERNEL32.DLL], "FlsAlloc") called from "MSVCR100.DLL" at address 0x6C30B3BF and returned 0x751C1F22.
GetProcAddress(0x751B0000 [KERNEL32.DLL], "FlsGetValue") called from "MSVCR100.DLL" at address 0x6C30B3CC and returned 0x751C123D.
GetProcAddress(0x751B0000 [KERNEL32.DLL], "FlsSetValue") called from "MSVCR100.DLL" at address 0x6C30B3D9 and returned 0x751C18E4.
GetProcAddress(0x751B0000 [KERNEL32.DLL], "FlsFree") called from "MSVCR100.DLL" at address 0x6C30B3E6 and returned 0x751C3954.
DllMain(0x6C2F0000, DLL_PROCESS_ATTACH, 0x0023FAA0) in "MSVCR100.DLL" returned 1 (0x1).
DllMain(0x743B0000, DLL_PROCESS_ATTACH, 0x0023FAA0) in "MSVCP100.DLL" called.
DllMain(0x743B0000, DLL_PROCESS_ATTACH, 0x0023FAA0) in "MSVCP100.DLL" returned 1 (0x1).
Second chance exception 0xC0000005 (Access Violation) occurred in "HUDPLUS.EXE" at address 0x002D4BF0.
Exited "HUDPLUS.EXE" (process 0x118C) with code -1073741819 (0xC0000005).


And the difference between your log file and mine starts here:

GetProcAddress(0x76B00000 [LPK.DLL], "LpkEditControl") called from "GDI32.DLL" at address 0x74B86991 and returned 0x76B07000.
DllMain(0x76690000, DLL_PROCESS_ATTACH, 0x0023FAA0) in "USER32.DLL" returned 1 (0x1).
DllMain(0x76790000, DLL_PROCESS_ATTACH, 0x0023FAA0) in "SHLWAPI.DLL" called.
DllMain(0x76790000, DLL_PROCESS_ATTACH, 0x0023FAA0) in "SHLWAPI.DLL" returned 1 (0x1).
DllMain(0x75490000, DLL_PROCESS_ATTACH, 0x0023FAA0) in "SHELL32.DLL" called.
DllMain(0x75490000, DLL_PROCESS_ATTACH, 0x0023FAA0) in "SHELL32.DLL" returned 1 (0x1).
DllMain(0x6C2F0000, DLL_PROCESS_ATTACH, 0x0023FAA0) in "MSVCR100.DLL" called.
GetProcAddress(0x751B0000 [KERNEL32.DLL], "FlsAlloc") called from "MSVCR100.DLL" at address 0x6C30B3BF and returned 0x751C1F22.
GetProcAddress(0x751B0000 [KERNEL32.DLL], "FlsGetValue") called from "MSVCR100.DLL" at address 0x6C30B3CC and returned 0x751C123D.
GetProcAddress(0x751B0000 [KERNEL32.DLL], "FlsSetValue") called from "MSVCR100.DLL" at address 0x6C30B3D9 and returned 0x751C18E4.
GetProcAddress(0x751B0000 [KERNEL32.DLL], "FlsFree") called from "MSVCR100.DLL" at address 0x6C30B3E6 and returned 0x751C3954.
DllMain(0x6C2F0000, DLL_PROCESS_ATTACH, 0x0023FAA0) in "MSVCR100.DLL" returned 1 (0x1).
DllMain(0x743B0000, DLL_PROCESS_ATTACH, 0x0023FAA0) in "MSVCP100.DLL" called.
DllMain(0x743B0000, DLL_PROCESS_ATTACH, 0x0023FAA0) in "MSVCP100.DLL" returned 1 (0x1).
Second chance exception 0xC0000005 (Access Violation) occurred in "HUDPLUS.EXE" at address 0x002D4BF0.
Exited "HUDPLUS.EXE" (process 0x118C) with code -1073741819 (0xC0000005).


...
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Patrice Terrier

Florent,

Quotea lot of work which in my opinion is not worth it

I wanted to check how much work i had to do to produce an EXE as small as PB with C++, and i think you hit the nail in my head, thank you.

...
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Florent Heyworth

Hi Patrice

I concurr :) A propos the exception: now we're getting into arcane territorry - take the /merge #pragmas out and recompile - does the exception still occur?

Cheers, Florent

Patrice Terrier

Florent,

One more question about your 26 Kb HUDplus.exe, does it works with the ZWP.exe child process.
I mean can you see the background animation and hear the audio playing when you check "Use visual plugin",
and can you change the audio file(s) and the visual plugin(s) when selecting them from combobox?

...
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Florent Heyworth

Hi Patrice

yes - clicking on Visual Plugin starts the music and I can select visual plugins which change  the background - just a thought about the exception:
go into the project properties/Code Generation and make sure Enable C++ exceptions "Yes (/EHsc)" is enabled - the exception you're seeing might be coming from one of the standard library calls (such as xlocale) which uses TRY_BEGIN macros - the second-chance exception should not be happening.

Cheers, Florent

Frederick J. Harris

Do you need the C++ Standard String Class Patrice?  I don't know how much string processing your application does, but if it isn't anything heavy duty or fancy, you could do this...

#include <string.h>

instead of this...

#include <string>

or this...

<cstring>

...at least nin VC9 I can do that ( VS 2008 )

and that drastically affects what gets compiled.  The difference on a static link like Florence mentioned would likely be around 40K.  You would still have the C style string primitives such as strcpy(), strncpy(), strcat(), etc.

Florent Heyworth

Quote from: Frederick J. Harris on February 12, 2011, 12:56:37 AM
Do you need the C++ Standard String Class Patrice?  I don't know how much string processing your application does, but if it isn't anything heavy duty or fancy, you could do this...

#include <string.h>

instead of this...

#include <string>

or this...

<cstring>

...at least nin VC9 I can do that ( VS 2008 )

and that drastically affects what gets compiled.  The difference on a static link like Florence mentioned would likely be around 40K.  You would still have the C style string primitives such as strcpy(), strncpy(), strcat(), etc.

Hi Frederick

actually Patrice's <string.h> directive was replaced by <string> - out of habit after I saw he was using the std namespace in the main program - so mea culpa to me ;)

Cheers, Florent

Patrice Terrier

I am using already <string.h> with VS2010 C/C++

However i can't get my code to be as small as Florent's, but his small 26 Kb EXE doesn't work by me.

The best i can do so far is a 76 Kb exe.

The only difference i can see between the PB and the C++ code, is is the use of the C++ string classes that makes the code larger.

...


Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Florent Heyworth

Patrice did you try my suggestion of Enabling /EHsc (exception handling) and recompiling the project - there's no reason I can see why it should not work provided the runtime is somewhere in your path?

Florent

Patrice Terrier

Florent,

I have removed the two extra pragma you added at the begining of WinLIFT.h:
//#pragma comment(linker, "/MERGE:.rdata=.data")
//#pragma comment(linker, "/MERGE:.text=.data")
(they were causing error by me)

as well as
//#pragma optimize("gsy", on)

and restored: #include <string.h> , everywhere.

And now the resulting EXE is only 25 Kb in size, and it works very well by me ;)

That is 3 Kb less than PB...

Thank you!

...
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com