Can't Link Mixed DLL with Visual Studio

  • Thread starter Thread starter andrew.bell.ia
  • Start date Start date
A

andrew.bell.ia

Hi,

I'm trying to link a mixed (CLR and native) DLL with visual studio. I
have it working fine on the command line, where cl is used to invoke
link, but I can't get it to work with VS. I get:

unresolved external symbol: __CorDllMain@12

I am linking in msvcrt.lib and msvcprt.lib explicitly.

Link info from visual studio is:

/OUT:"C:\acbell\mrsid\Release\mrsid.dll" /NOLOGO
/LIBPATH:"C:\acbell\thirdparty\LizardTech\Geo_DSDK-5.0.6.955\3rd-party\lib\Release_md"
/LIBPATH:"C:\acbell\thirdparty\LizardTech\Geo_DSDK-5.0.6.955\lib\Release_md"
/DLL /NODEFAULTLIB:"nochkclr.obj" /INCLUDE:"__DllMainCRTStartup@12"
msvcrt.lib msvcprt.lib lti_dsdk.lib gdal.lib gdalogr.lib gdalcpl.lib
ltikdu.lib advapi32.lib user32.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
"\acbell\thirdparty\LizardTech\Geo_DSDK-5.0.6.955\lib\Release_md\lti_dsdk.lib"
"\acbell\thirdparty\LizardTech\Geo_DSDK-5.0.6.955\3rd-party\lib\Release_md\gdal.lib"
"\acbell\thirdparty\LizardTech\Geo_DSDK-5.0.6.955\3rd-party\lib\Release_md\gdalogr.lib"
"\acbell\thirdparty\LizardTech\Geo_DSDK-5.0.6.955\3rd-party\lib\Release_md\gdalcpl.lib"

/noentry is also specified as an additional property.

Any help appreciated.

-- Andrew Bell
(e-mail address removed)
 
I get to answer my own question again. Linking in mscoree.lib fixed
things. Another group posting suggested that the symbol was in
msvcprt.lib, which doesn't seem to be the case. BTW, is there a way to
list the exported symbols in a library? I tried lib /list /verbose,
but it only gave the corresponding dll name, not the symbol name.

Thanks,

-- Andrew Bell
(e-mail address removed)
 
I get to answer my own question again. Linking in mscoree.lib fixed
things. Another group posting suggested that the symbol was in
msvcprt.lib, which doesn't seem to be the case. BTW, is there a way
to list the exported symbols in a library? I tried lib /list
/verbose, but it only gave the corresponding dll name, not the symbol
name.

try dumpbin /symbols.

It'll list lots of stuff that you don't need, but you can find all the
public symbols in the results.

-cd
 
Back
Top