Can't Link Mixed DLL with Visual Studio

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)
 
A

andrew.bell.ia

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)
 
C

Carl Daniel [VC++ MVP]

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top