Embeddinator fails to generate C++ Static Library from .NET library on Windows
#740 创建于 2019年9月5日
仓库指标
- Star
- (758 star)
- PR 合并指标
- (PR 指标待抓取)
描述
I wanted to create a C++ library for a .NET library using Embeddinator-4000.exe. However, when I am setting '--gen=c++', I am getting following exception (Tried with both 32 Bit and 64 Bit Mono versions).
Unhandled Exception: System.NotImplementedException: The method or operation is not implemented. at Embeddinator.Driver.CreateGenerator() at Embeddinator.Driver.Process() at Embeddinator.Driver.Run() at Embeddinator.CLI.Main(String[] args)
As I got stuck for C++ so thought of doing the same by setting '--gen=c'. However, I am getting 'LINK : fatal error LNK1561: entry point must be defined' error.
Steps to Reproduce
- Create a 'Class Library (.NET Standard)' project in VS2017 with name 'MonoTestDLL'
- Add following code to the class which is default created template
.
public class Class1
{
public Class1()
{
System.Console.WriteLine("Class1 .NET Initialzed Successfully");
}
public void PrintMessage()
{
System.Console.WriteLine("Class1 .NET In PrintMessage");
}
public void PrintMessage(string strStringToPrint)
{
System.Console.WriteLine(strStringToPrint);
}
public int Add(int iNum1, int iNum2)
{
return iNum1 + iNum2;
}
static void Main(string[] args)
{
System.Console.WriteLine("Class1 .NET In main");
}
}
3. Build the library. (The .dll file will be created with MonoTestDLL.dll) 4. Now, build the C++ libraries for this .NET dll using Embeddinator-4000 using following command,
Embeddinator-4000.exe --gen=c --platform=Windows --compile --target=static --outdir="C:\Temp\MonoLibs" "${SolutionDir}\bin\Debug\netstandard2.0\MonoTestDLL.dll"
Note: You can replace the path of dll per solution location
- Observe following error,
LINK : fatal error LNK1561: entry point must be defined Failed to compile generated code.
- I tried by manually adding the main function to C# class, but no luck.
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
Fails with exception
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.