I have built a cpp dll with output configuration manager settings as shown in the snapshot
.
It builds successfully and dll gets created.Then to consume it I have written a c# project that includes the dll as follows
[System.Security.SuppressUnmanagedCodeSecurity]
[DllImport(@"somePath\ImgProcessorTrial.dll", EntryPoint = "ImgProc")]
After that I built it with the configuration as shown in the figure
When i try to run this application I get the following output in the console.
BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)
After that When I change the build configurations and try to build it again the cpp project does not build and gives a lot of errors of the type as given below.
unresolved external symbol for all functions of leptonica library
This particular library leptonica and all the necessary ones are built individually on a 64 bit machine.When I try to change the configurations of the c# project I get the exception
DLLNotFoundException
What I do in the project is invoke the dll functions to read an image and manipulate it.I thought it was related to the format of the image i am trying to read.So I tried to Run the application with a .jpeg and .tif but with the same output always.I am doing all of this on a visual studio 2013 and framework 3.5 on a 64 bit machine.What is the exact meaning of the BadImageFormatException and how to solve it?Is it a code issue or architecture issue?