I'm building an addon for NodeJS.
Works just right in Windows 7. But in Windows XP it won't load, doesn't open it no matter what I do. ERROR: Unable to load shared library c:\tst\tst.node
I'm compiling the DLL from VS2010 with the following options:
c/c++ opts
/I"c:\tst\nodemodule\cvv8\include" /I"c:\tst\nodemodule\node-src\deps\uv\include" /I"c:\tst\nodemodule\node-src\deps\v8\include" /I"c:\tst\nodemodule\node-src\src" /I"c:\tst\nodemodule\node-src\deps\zlib" /I"c:\tst\nodemodule\node-src\deps\http_parser" /I"c:\tst\nodemodule\cvv8\include\cvv8" /Zi /nologo /W0 /WX- /O2 /Oi /Oy- /GL /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "TST_EXPORTS" /D "_WINDLL" /D "_UNICODE" /D "UNICODE" /Gm- /EHsc /GS /Gy /fp:precise /Zc:wchar_t /Zc:forScope /Fp"Release\tst.pch" /Fa"Release\" /Fo"Release\" /Fd"Release\vc100.pdb" /Gd /analyze- /errorReport:queue
linker opts
/OUT:"c:\tst\tst.node" /INCREMENTAL:NO /NOLOGO /DLL "kernel32.lib" "user32.lib" "gdi32.lib" "winspool.lib" "comdlg32.lib" "advapi32.lib" "shell32.lib" "ole32.lib" "oleaut32.lib" "uuid.lib" "odbc32.lib" "odbccp32.lib" /MANIFEST:NO /ManifestFile:"Release\tst.node.intermediate.manifest" /ALLOWISOLATION /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /PDB:"c:\tst\tst.pdb" /SUBSYSTEM:WINDOWS /OPT:REF /OPT:ICF /PGD:"c:\tst\tst.pgd" /LTCG /TLBID:1 /DYNAMICBASE /NXCOMPAT /MACHINE:X86 /ERRORREPORT:QUEUE
What's wrong? Is this UTF-8 related?
The best tool to diagnose such problems is the dependency walker.
Open your dll in dw and you'll immediately see why it won't load: most likely there are some dlls/libs missing your dll depends upon.
Before including windows headers (usually in stdafx.h), try setting the windows version macros to ensure you're not using api's that are only available after XP.
http://msdn.microsoft.com/en-us/library/windows/desktop/aa383745(v=vs.85).aspx#setting_winver_or__win32_winnt
Related
I am using VS 2022 and C++ with modules.
In Debug mode every now and then when I want to run application it does not start. Then to see what is happening I go ahead to debug it and then have "guard_dispatch.asm not found: Source link authentication failed" message. Therefore I can neither run it nor debug the application at all. When I rebuild the whole application everything gets back to normal but comes back randomly again.
C++ settings:
/JMC /experimental:module /MP /ifcOutput "x64\Debug" /GS /W3 /Zc:wchar_t /I"C:_ExternalCPPLibraries\64Bit_143\wxWidgets-3.2.0\lib\mswud" /ZI /Gm- /Od /sdl /Fd"x64\Debug\vc143.pdb" /Zc:inline /fp:precise /D "_UNICODE" /D "WXMSW" /D "wxUSE_NATIVE_DATAVIEWCTRL" /D "wxUSE_MENUBAR" /D "UNICODE" /D "WXUSINGDLL" /D "_CRT_SECURE_NO_WARNINGS" /D "_MBCS" /errorReport:prompt /WX- /Zc:forScope /RTC1 /Gd /MDd /std:c++latest /FC /Fa"x64\Debug" /EHsc /nologo /Fo"x64\Debug%(RelativeDir)" /Fp"x64\Debug\sciencesuit.pch" /diagnostics:column
Linker Settings:
/OUT:"C:\Users...\VS2022\Proj\PY\sciencesuit.exe" /MANIFEST /NXCOMPAT /PDB:"C:\Users...\VS2022\Proj\PY\sciencesuit.pdb" /DYNAMICBASE "wxmsw32ud.lib" "wxexpatd.lib" "wxjpegd.lib" "wxpngd.lib" "wxscintillad.lib" "wxtiffd.lib" "wxzlibd.lib" "boost_math_tr1-vc143-mt-gd-x64-1_81.lib" "opencv_core455d.lib" "opencv_imgproc455d.lib" "opencv_imgcodecs455d.lib" "opencv_videoio455d.lib" "python310.lib" "python3.lib" "npymath.lib" "lua54.lib" "kernel32.lib" "user32.lib" "gdi32.lib" "winspool.lib" "comdlg32.lib" "advapi32.lib" "shell32.lib" "ole32.lib" "oleaut32.lib" "uuid.lib" "odbc32.lib" "odbccp32.lib" /DEBUG:FULL /MACHINE:X64 /INCREMENTAL /PGD:"C:\Users...\VS2022\Proj\PY\sciencesuit.pgd" /SUBSYSTEM:WINDOWS /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /ManifestFile:"x64\Debug\sciencesuit.exe.intermediate.manifest" /LTCGOUT:"x64\Debug\sciencesuit.iobj" /ERRORREPORT:PROMPT /ILK:"x64\Debug\sciencesuit.ilk" /NOLOGO /TLBID:1
Any ideas appreciated.
I am compiling some program i wrote, and when i run strings.exe (from sysinternals, a tool which displays the strings in a binary file) i see variable names from my code.
I am using visual studio C++ compiler, i already tried to disable debug info generation and playing with the project properties but nothing helped so far.
Has anyone encountered this problem before?
Thanks.
EDIT:
as requested, the compilations command lines.
compiler:
/permissive- /Yu"pch.h" /GS- /analyze- /W3 /Zc:wchar_t /Zi /Gm- /Od /sdl /Fd"Debug\vc141.pdb" /fp:precise /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_UNICODE" /D "UNICODE" /errorReport:prompt /GF- /WX- /Zc:forScope /RTCs /GR- /Gd /Oy- /MTd /FC /Fa"Debug\" /nologo /Fo"Debug\" /Fp"Debug\a.pch" /diagnostics:classic
linker:
/OUT:"C:\a.exe" /MANIFEST /NXCOMPAT:NO /FUNCTIONPADMIN /PDB:"C:\a.pdb" /DYNAMICBASE "kernel32.lib" "user32.lib" "gdi32.lib" "winspool.lib" "comdlg32.lib" "advapi32.lib" "shell32.lib" "ole32.lib" "oleaut32.lib" "uuid.lib" "odbc32.lib" "odbccp32.lib" /FIXED:NO /DEBUG /MACHINE:X86 /INCREMENTAL:NO /PGD:"C:\a.pgd" /SUBSYSTEM:CONSOLE /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /ManifestFile:"Debug\a.exe.intermediate.manifest" /ERRORREPORT:PROMPT /NOLOGO /TLBID:1
I have the following (example) code of which I require to compile a release version.
// library.cpp : Defines the exported functions for the DLL application.
//
#include <stdio.h>
extern "C"
{
__declspec(dllexport) void DisplayHelloFromDLL( int value)
{
printf("Hello from DLL : data=%d\n", value);
}
}
The code compiles and links with one problem that it refers to the debug version of the
runtime library no matter what I try.
Platform Visual Studio 2013 update 5
Issues - Links to MSVCR120d.dll as opposed to MSVCR120.dll
Configuration Release - Win32 Dll
Manifest Present
Compiler CLI
/GS /GL /analyze- /W3 /Gy /Zc:wchar_t /Zi /Gm- /O2 /Fd"Release\vc120.pdb" /fp:precise /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "LIBRARY_EXPORTS" /D "_WINDLL" /D "_UNICODE" /D "UNICODE" /errorReport:prompt /WX- /Zc:forScope /Gd /Oy- /Oi /MD /Fa"Release\" /EHsc /nologo /Fo"Release\" /Fp"Release\library.pch"
Note: /MD is correct i.e. no static, no debug, dll
Linker CLI
/OUT:"C:_progdbg\Call_DLL\Caller\Release\library.dll" /MANIFEST /LTCG /NXCOMPAT /PDB:"C:_progdbg\Call_DLL\Caller\Release\library.pdb" /DYNAMICBASE "kernel32.lib" "user32.lib" "gdi32.lib" "winspool.lib" "comdlg32.lib" "advapi32.lib" "shell32.lib" "ole32.lib" "oleaut32.lib" "uuid.lib" "odbc32.lib" "odbccp32.lib" /IMPLIB:"C:_progdbg\Call_DLL\Caller\Release\library.lib" /DLL /MACHINE:X86 /OPT:REF /SAFESEH /INCREMENTAL:NO /PGD:"C:_progdbg\Call_DLL\Caller\Release\library.pgd" /SUBSYSTEM:WINDOWS /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /ManifestFile:"Release \library.dll.intermediate.manifest" /OPT:ICF /ERRORREPORT:PROMPT /NOLOGO /TLBID:1
Dependency Walker shows that library is dependent on MSVCR120d.dll
Could someone please tell me which setting is wrong.
Many Thanks
I'm using Visual Studio 2013 and I want to use libcurl statically (without any external dlls).
I've statically linked libcurl that I've compiled with the following command:
nmake /f Makefile.vc mode=static WITH_SSL=static WITH_DEVEL=C:\OpenSSL-Win32 VC=12 ENABLE_SSPI=no ENABLE_IDN=no ENABLE_WINSSL=no DEBUG=no MACHINE=x86 GEN_PDB=no ENABLE_IPV6=yes
I have downloaded OpenSSL and linked the following libs to my project:
C:\OpenSSL-Win32\lib\VC\static\zlibeay32MD.lib
C:\OpenSSL-Win32\lib\VC\static\ssleay32MD.lib
Everything seems to be fine, and I can successfully compile my project.
But when I run the program, I'm receiving the following error:
If I put libeay32.dll and ssleay32.dll to the same folder of program it works without problem.
I don't understand why it requires these dlls, I've used WITH_SSL=static option to compile libcurl and should load from static library, right?
Update:
C/C++ -> Command Line:
/Yu"stdafx.h" /GS /GL /analyze- /W3 /Gy /Zc:wchar_t /I"C:\VisualCpp\Libraries\curl-7.42.1\builds\libcurl-vc12-x86-release-static-ssl-static-ipv6\include\curl" /I"C:\OpenSSL-Win32\\include\openssl" /Zi /Gm- /O2 /sdl /Fd"Release\vc120.pdb" /fp:precise /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "CURL_STATICLIB" /D "_UNICODE" /D "UNICODE" /errorReport:prompt /WX- /Zc:forScope /Gd /Oy- /Oi /MD /Fa"Release\" /EHsc /nologo /Fo"Release\" /Fp"Release\Launcher.pch"
Linker -> Command Line:
/OUT:"C:\VisualCpp\Launcher\Release\Launcher.exe" /MANIFEST /LTCG /NXCOMPAT /PDB:"C:\VisualCpp\Launcher\Release\Launcher.pdb" /DYNAMICBASE "libcurl_a.lib" "libeay32MD.lib" "ssleay32MD.lib" "ws2_32.lib" "wldap32.lib" "advapi32.lib" "kernel32.lib" "comdlg32.lib" "user32.lib" "gdi32.lib" "winspool.lib" "shell32.lib" "ole32.lib" "oleaut32.lib" "uuid.lib" "odbc32.lib" "odbccp32.lib" /MACHINE:X86 /NODEFAULTLIB:"libcmt.lib" /OPT:REF /SAFESEH /INCREMENTAL:NO /PGD:"C:\VisualCpp\Launcher\Release\Launcher.pgd" /SUBSYSTEM:WINDOWS /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /ManifestFile:"Release\Launcher.exe.intermediate.manifest" /OPT:ICF /ERRORREPORT:PROMPT /NOLOGO /TLBID:1
I have two Visual C++ apps. Both part of a DVR system. They share a single live555 library. On is a generic RTSP server. The other accesses cameras and downloads video clips using RTSP. Both compile and deploy fine in Visual Studio 2008. The one that downloads clips fails with missing msvcr120d.dll error. They are not compiled in debug. The both have pretty much the same compile/link options:
This works:
/GS /GL /analyze- /W3 /Gy- /Zc:wchar_t /I".\" /I"SharedLibraries\mediaServer" /I"SharedLibraries\mediaServer\include" /I"SharedLibraries\LiveMedia" /I"SharedLibraries\LiveMedia\include" /I"SharedLibraries\Groupsock" /I"SharedLibraries\Groupsock\include" /I"SharedLibraries\BasicUsageEnvironment" /I"SharedLibraries\BasicUsageEnvironment\include" /I"SharedLibraries\UsageEnvironment" /I"SharedLibraries\UsageEnvironment\include" /I"SharedLibraries" /Zi /Gm /Od /Fd".\obj\Release\vc120.pdb" /fp:precise /D "WIN32" /D "_CONSOLE" /D "_UNICODE" /D "UNICODE" /errorReport:prompt /WX- /Zc:forScope /RTC1 /Gd /Oy- /MD /Fa".\obj\Release\" /EHsc /nologo /Fo".\obj\Release\" /Fp".\obj\Release\VGRTSPServer.pch"
/OUT:"M:\VG CODE\Vg\V1\D1\Dvr\Output\Tracker Monitor\VGRTSPServer.exe" /MANIFEST /LTCG /NXCOMPAT /PDB:"M:\VG CODE\Vg\V1\D1\Dvr\Output\Tracker Monitor\VGRTSPServer.pdb" /DYNAMICBASE "wsock32.lib" "kernel32.lib" "user32.lib" "gdi32.lib" "winspool.lib" "comdlg32.lib" "advapi32.lib" "shell32.lib" "ole32.lib" "oleaut32.lib" "uuid.lib" "odbc32.lib" "odbccp32.lib" /MACHINE:X86 /OPT:REF /SAFESEH /INCREMENTAL /PGD:"M:\VG CODE\Vg\V1\D1\Dvr\Output\Tracker Monitor\VGRTSPServer.pgd" /SUBSYSTEM:CONSOLE /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /ManifestFile:".\obj\Release\VGRTSPServer.exe.intermediate.manifest" /OPT:ICF /ERRORREPORT:PROMPT /NOLOGO /TLBID:1
Doesn't work:
/GS /TP /GL /analyze- /W3 /Gy /Zc:wchar_t /I".\" /I"SharedLibraries\mediaServer" /I"SharedLibraries\mediaServer\include" /I"SharedLibraries\LiveMedia" /I"SharedLibraries\LiveMedia\include" /I"SharedLibraries\Groupsock" /I"SharedLibraries\Groupsock\include" /I"SharedLibraries\BasicUsageEnvironment" /I"SharedLibraries\BasicUsageEnvironment\include" /I"SharedLibraries\UsageEnvironment" /I"SharedLibraries\UsageEnvironment\include" /I"SharedLibraries" /Zi /Gm- /O2 /Fd"Release\vc120.pdb" /fp:precise /D "WIN32" /D "_CONSOLE" /fp:except- /errorReport:prompt /GF- /WX- /Zc:forScope /GR /Gd /Oy- /Oi /MD /openmp- /Fa"Release\" /EHsc /nologo /Fo"Release\"
/OUT:"M:\VG CODE\Vg\V1\D1\Dvr\Output\Tracker Monitor\VGVideoBufferer.exe" /MANIFEST /LTCG /NXCOMPAT /PDB:"M:\VG CODE\Vg\V1\D1\Dvr\Output\Tracker Monitor\VGVideoBufferer.pdb" /DYNAMICBASE "wsock32.lib" /MACHINE:X86 /OPT:REF /SAFESEH /INCREMENTAL:NO /PGD:"M:\VG CODE\Vg\V1\D1\Dvr\Output\Tracker Monitor\VGVideoBufferer.pgd" /SUBSYSTEM:CONSOLE /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /ManifestFile:"Release\VGVideoBufferer.exe.intermediate.manifest" /OPT:ICF /ERRORREPORT:PROMPT /CLRUNMANAGEDCODECHECK:NO /NOLOGO /ASSEMBLYDEBUG:DISABLE /TLBID:1
The only difference I can see is that the first one had more /DYNAMICBASE libraries, how would adding unnecessary libraries make a difference here?
Took a whack at it with depends, which says the predictable my app is dependent on msvcr120d.dll. It notes that all of c is involved along with some things I don't understand:
type_info::~type_info(void)
void * operator new(unsigned int)
void operator delete(void *)
void terminate(void)
_CRT_RTC_INITW
_CrtDbgReportW
_CrtSetCheckCount
_CxxThrowException
_XcptFilter
__CxxFrameHandler3
__crtSetUnhandledExceptionFilter
__crtTerminateProcess
__crtUnhandledException
__dllonexit
__getmainargs
__initenv
__iob_func
__set_app_type
__setusermatherr
_amsg_exit
_calloc_dbg
_cexit
(can't post an image. not enough rep)
I've been at this off and on for three days.