"Unable to find an entry point named [function] in dll" (c++ to c# type conversion)

First make sure the function is actually exported:

In the Visual Studio Command Prompt, use dumpbin /exports whatever.dll


C# doesn't support C++ name mangling and you either need to declare the C++ functions with

extern "C" {...}

(may not an option if they're from a third party), or call the mangled name directly if you can get it to work. It may be easier to get the third party to provide a non-mangled interface to the functionality.


Solved - at least to the point where the program does not break and actually returns me a bool value.

The key, I guess, was to specify the entry point as the 'mangled' name

    [DllImport(@"cnOCRsdk.dll", EntryPoint="?recoCHN_P_Name@CcnOCRsdk@@QAE_NPADPAURECO_DATA@@@Z")]
    public static extern bool recoCHN_P_Name(ref string imgPath, ref RECO_DATA o_data);

After that I got some other errors but the 'unable to find entry point' went away.