Open salunkhesagar1386 opened 5 years ago
Similar / Duplicate of https://github.com/mono/Embeddinator-4000/issues/740 ?
I'm having a very similar issue on my first attempt to use Embeddinator.
- Copy the 'MonoTestDLL.dll' at the path where 'TestCLIApp.exe' resides
Which MonoTestDLL.dll do you mean? If I follow you, there are two options. One is generated from your C# project. The other one is Embeddinator's result. Either way, I have no luck even trying both of them.
@salunkhesagar1386 I've just noticed that this open issue is not so new. Could you solve your issue?
I am trying to use the C++ library (.dll) created for a .NET library using Embeddinator-4000.exe in Windows C++ console app. However, when I am using executing the windows C++ console app, application shows following error dialog
Steps to Reproduce
.
Embeddinator-4000.exe --gen=c --platform=Windows --compile --target=shared --outdir="C:\Temp\MonoLibs" "${SolutionDir}\bin\Debug\netstandard2.0\MonoTestDLL.dll"
Note: You can replace the path of dll per solution location
Embeddinator will generate following files along with the Mono's library files, MonoTestDLL.h MonoTestDLL.c MonoTestDLL.lib MonoTestDLL.dll MonoTestDLL.exp
Now create a new 'Windows Console Application' in Visual C++ using Visual Studio 2017 with name 'TestCLIApp'.
Add following code in 'TestCLIApp.cpp' file which is created by default in the template.
Add following path in 'Include Directories' option by selecting the Project Properties, C:\Program Files (x86)\Mono\include\mono-2.0;
Add 'MonoTestDLL.lib' in Linker>>Input. (make sure you add proper library path in 'Library Directories' option)
Copy the 'MonoTestDLL.dll' at the path where 'TestCLIApp.exe' resides
Build and execute the C++ console application.
Expected Behavior
Command execution shall work fine and I am expecting 'MonoTestDLL.lib' and wrapper files to be generated by the Embeddinator tool which I can further use in my C++ executable or library.
Actual Behavior
Application fails to load with above mentioned error dialog
Environment
Windows Installed Mono and Embeddinator using VS2017 NuGet package.
Set paths of Mono and Embeddinator executable folder in environment variables using %PATH% on command prompt to avoid errors.