Hasan H
Hasan H

Reputation: 141

System.EntryPointNotFoundException when calling function from DLL

I am trying to use an external DLL library. All the functions that I used so far are working fine except for this one function which throws an EntryPointNotFoundException

I tried using VS dumpbin and I can find the function's name in the exports

Dumpbin Result

My dllimport code

[return: MarshalAs(UnmanagedType.I1)]
[DllImport(DLLPATH, EntryPoint = prefix + "APIConfigureEyeMeasurements"]
protected static extern bool ConfigureEyeMeasurements(byte instance, bool doTopMeasurements, bool doBaseMeasurements, bool doMin,
                                      bool doMax, bool doRiseTime, bool doFallTime, bool doPeakToPeak,
                                      bool doEyeAmplitude, bool doEyeHeight, bool doEyeWidth, bool doCrossingPercentage, bool doJitter, bool doSNR, bool doVEC, bool doTDEC);

The function from its header file:

bool __stdcall APIConfigureEyeMeasurements(
    byte instance,
    bool doTopMeasurements, bool doBaseMeasurements, bool doMin,
    bool doMax, bool doRiseTime, bool doFallTime, bool doPeakToPeak,
    bool doEyeAmplitude, bool doEyeHeight, bool doEyeWidth,
    bool doCrossingY, bool doJitter, bool doSNR, bool doVEC, bool doTDEC);

Could it be something caused by the parameters or from the import that I am using. The strange thing is that all the other functions are working fine

Upvotes: 1

Views: 578

Answers (1)

David Heffernan
David Heffernan

Reputation: 612854

Your C# declaration has 16 arguments, each of which consume 4 bytes of stack space. Therefore the postfix should be @64. It is actually @68 which means that your declaration of the function is incorrect. You are probably missing an argument, or have misdeclared the type of an argument, which I am sure you will discover if you double check with the C++ header file.

Ah, I've just re-read the question right the way to the end, and seen that the header file is also missing an argument. So it seems like you will need to get in touch with the developer of the DLL to resolve this issue. The DLL that you are using does not match the header file that you have.

Upvotes: 3

Related Questions