A business partner has created a DLL written in C++.
Our partner describes that the C++ DLL methods can be accessed by using this code in C++ (we have tested and it works very well with this code written in C++)
create_func_ptr createInstance = (create_func_ptr)(GetProcAddress(hdl, "createReader"));
LudvigInterface* ludvigInterface = createInstance();
if (ludvigInterface)
{
bool isRunning = ludvigInterface->isRunning();
destroy_func_ptr closeInstance = (destroy_func_ptr)(GetProcAddress(hdl, "closeReader"));
closeInstance(ludvigInterface);
}
But our challenge is that we want to do the same in C#.
We are able to open the DLL through DLLImport statements, and everything runs well until we try to access the isRunning method.
class Program
{
[DllImport(@"\Libraries\LudvigImplementation.dll")]
private static extern IntPtr createReader();
[DllImport(@"\Libraries\LudvigImplementation.dll")]
private static extern bool isRunning();
static void Main(string[] args)
{
IntPtr LudvigInterfacePtr = createReader(); //this line runs well
var a = isRunning(); //This line gives a System.EntryPointNotFoundException: 'Unable to find an entry point named 'isRunning' in DLL LudvigImplementation.dll'
}
}
How can we solve this? How can we access the DLL isRunning method in C#?
Thanks a lot
UPDATED 2. MAY AT 13:31 CET:
I got some questions of how the LudvigInterface looks like Here it is (LudvigInterface.h)
class LudvigInterface
{
public:
virtual bool isRunning() = 0;
virtual char* getVersion() = 0;
};
Thanks again