I have a .NET DLL and a sample code in Matlab, which uses this DLL and works. The Matlab code which imports the DLL is
function ReaderLib = ReaderInitialize(dllPath)
netObj = NET.addAssembly(dllPath);
ReaderLib = System.Activator.CreateInstance(netObj.AssemblyHandle.GetType('lib.ReaderDotNet'));
end
This function returns the object which exposes all functions of the DLL.
I need to use this DLL in existing Python and/or R code, but I was not able to make it work.
In Python I tried
import ctypes
DllObj = ctypes.WinDLL (dllPath)
In R I tried
DllObj <- dyn.load(dllPath)
In both cases I obtain more or less empty objects, so I assume I am not doing it right. What is the correct way to import this DLL in Python and/or R?