This repository has been archived by the owner on Oct 25, 2021. It is now read-only.
c++ dll created for .NET dll using Embeddinator 4000, fails to load in C++ console application #741
Labels
Milestone
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.
The text was updated successfully, but these errors were encountered: