.net - BadImageFormatException or System.DllNotFoundException When trying to run a c# project -
i have built cpp dll output configuration manager settings shown in snapshot
.
it builds , dll gets created.then consume have written c# project includes dll follows
[system.security.suppressunmanagedcodesecurity] [dllimport(@"somepath\imgprocessortrial.dll", entrypoint = "imgproc")]
after built configuration shown in figure
when try run application following output in console.
badimageformatexception: attempt made load program incorrect format. (exception hresult: 0x8007000b)
after when change build configurations , try build again cpp project not build , gives lot of errors of type given below.
unresolved external symbol functions of leptonica library
this particular library leptonica , necessary ones built individually on 64 bit machine.when try change configurations of c# project exception
dllnotfoundexception
what in project invoke dll functions read image , manipulate it.i thought related format of image trying read.so tried run application .jpeg , .tif same output always.i doing of on visual studio 2013 , framework 3.5 on 64 bit machine.what exact meaning of badimageformatexception , how solve it?is code issue or architecture issue?
badimageformat not related .jpeg or .tif...
this exception thrown when file format of dynamic link library (.dll file) or executable (.exe file) not conform format expected common language runtime.
in case you're calling dll 64 bit have compile project x64. badimageformat when targeting x86
Comments
Post a Comment