我正在尝试MimeTex.dll
在 C++/CLI 项目的混合模式中使用。我通过以下方式包含 dll:
#pragma comment(lib,"MimeTex.dll")
我试图调用这个方法:
CreateGifFromEq("expression","path");
但编译器通知它不知道 CreateGifFromEq() 方法。
我没有在网上找到有关如何 MimeTex.dll
在 C++ 中使用的资源。我只是在Pinvok的这个链接中找到了如何将它与 C# 一起使用,例如:
[System.Security.SuppressUnmanagedCodeSecurity()]
internal class NativeMethods
{
private NativeMethods()
{ //all methods in this class would be static
}
[System.Runtime.InteropServices.DllImport("MimeTex.dll")]
internal static extern int CreateGifFromEq(string expr, string fileName);
[System.Runtime.InteropServices.DllImport("kernel32.dll")]
internal extern static IntPtr GetModuleHandle(string lpModuleName);
[System.Runtime.InteropServices.DllImport("kernel32.dll")]
[return: System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.Bool)]
internal extern static bool FreeLibrary(IntPtr hLibModule);
}
然后像这样称呼它:
NativeMethods.CreateGifFromEq(equation, tempGifFilePath);
在 C++/CLI 的混合模式下,如何在没有 Pinvok 的情况下调用它?