Tim
Tim

Reputation: 2911

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. I make several calls to the dll, and they all are working except for one.

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.

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. 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.

Upvotes: 5

Views: 13984

Answers (1)

Tergiver
Tergiver

Reputation: 14517

EntryPointNotFoundException means that the symbol ObjectGetStringEntryID is not exported by the DLL. Check the export file (or __declspec declaration) to make sure it is exported, and by that name.

This may help: Exporting from a DLL

Upvotes: 3

Related Questions