Native C++ dll in one solution with C# project -
I have a source file written in C ++, execution of some simulations, I create a user interface in C # Want to How can I get both C ++ and C # in a single visual studio solution?
What I've done so far I had created a .NET C # project and solution, and then as a native project DLL library. I have marked the C # project as "depends" on the C ++ dell I've imported using the dllexport
instructions and DllImport
. Everything compiled properly, but when I execute the application, dll was not found:
Unable to load DLL 'xxxx.dll': The specified module was not found.
It is no wonder that DLL is not found, because this application is run from its output directory and output directories are different for C # and C ++ projects. I do not want to write a clear path in my form like ".. .. \ debug \ xxxxx.dll".
Is there a general way to structure a DLL solution and C # app can call C # APP native DLL?
If you know that after deployment your C ++ DLL is your C # DLL (or executable) ), Then to use the PostBuild Event (Project Properties, Build Event) to solve the problem.
You can add a copy command that will put your C ++ DLL into the C # output folder.
Comments
Post a Comment