c# - DLLimport unable to load dll -
c# - DLLimport unable to load dll -
i using unmanaged dll in cpp phone call from c# web project. works fine on localhost not work on shared hosting, winhost. happens when seek utilize 1 of function in dll.
the error message getting is:
"unable load dll 'dlltest.dll': application has failed start because side-by-side configuration incorrect. please see application event log or utilize command-line sxstrace.exe tool more detail. (exception hresult: 0x800736b1)","errors":[{"name":"dllnotfoundexception","message":"unable load dll 'dlltest.dll': application has failed start because side-by-side configuration incorrect. please see application event log or utilize command-line sxstrace.exe tool more detail. (exception hresult: 0x800736b1)"}]}
i suspecting path issue. dll in question, dlltest.dll placed in bin folder. not sure searching dll there way can specify path search of dll. can't find way specify relative path dll.
i not think dependency issue because dlltest.dll simple test , contains simple add together function.
or not other causes?
thanks help.
the problem c++ dll requires crt libraries installed in order work. bolded part of error message gives hint:
unable load dll 'dlltest.dll': the application has failed start because side-by-side configuration incorrect. please see application event log or utilize command-line sxstrace.exe tool more detail.
that explains why fine on development machine—-they're installed there because got installed development tools—and why doesn't work on production server, doesn't have crt redistributables installed.
you need download appropriate redistributable bundle version of visual studio compiled dll with. example, if you're using visual studio 2010, can download version 10 of crt redistributable here.
alternatively, compile dll runtime libraries statically linked. that, alter project properties throw /mt
switch instead of /md
—(it's found in ui under "configuration properties" -> "c/c++" -> "code generation" -> "runtime library").
c# c++ dll interop dllimport
Comments
Post a Comment