[英]Unable to find an entry point named
I am coding an application in c# that makes use of a third-party dll coded in cpp. 我在c#编写一个应用程序,它使用在cpp中编码的第三方dll。 I make several calls to the dll, and they all are working except for one.
我打了几个电话给dll,除了一个,它们都在工作。
My code makes the call in the following manner: 我的代码以下列方式进行调用:
return ObjectGetStringEntryID(pObject, strEntryID, strEntryID.Capacity);
[DllImport(EXTERNAL_DLL, CharSet = DefaultCharSet)]
protected static extern bool ObjectGetStringEntryID(IntPtr pObject, StringBuilder strEntryID, int nMaxLength);
Since I have access to the source code, I know it contains the following definition: 由于我可以访问源代码,因此我知道它包含以下定义:
BOOL ObjectGetStringEntryID(CMAPIObject* pObject, LPTSTR szEntryID, int nMaxLength)
As stated before, I make several other calls to this dll using the same format, and they are successful. 如前所述,我使用相同的格式对此dll进行了几次其他调用,并且它们是成功的。
Consequently, I have the following setting if it helps: 因此,如果有帮助,我有以下设置:
public const CharSet DefaultCharSet = CharSet.Ansi;
Does anyone see what I may be doing wrong in my call? 有人在我的电话中看到我可能做错了吗? From the same class, I call:
从同一个班级,我打电话给:
MessageGetSubject(pObject, strSubject, strSubject.Capacity);
[DllImport(EXTERNAL_DLL, CharSet = DefaultCharSet)]
protected static extern void MessageGetSubject(IntPtr pMessage, StringBuilder strSubject, int nMaxLength);
Which matches up to the method: 哪个符合方法:
void MessageGetSubject(CMAPIMessage* pMessage, LPTSTR szSubject, int nMaxLength)
This comes from the same classes in both c# and cpp as the call that is not working, but it works just fine. 这来自c#和cpp中的相同类,因为调用不起作用,但它工作得很好。 There does not appear to be any difference in how it is called, so they both should either work or not work.
它的调用方式似乎没有任何差别,因此它们既可以工作也可以不工作。
If anyone has any insight into what I am doing wrong, I would greatly appreciate the assistance. 如果有人对我做错了什么有任何见解,我将非常感谢你的帮助。
EntryPointNotFoundException
means that the symbol ObjectGetStringEntryID
is not exported by the DLL. EntryPointNotFoundException
意味着DLL不会导出符号ObjectGetStringEntryID
。 Check the export file (or __declspec declaration) to make sure it is exported, and by that name. 检查导出文件(或__declspec声明)以确保导出文件以及该名称。
This may help: Exporting from a DLL 这可能有所帮助: 从DLL导出
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.