I am currently working on a Wrapper Class for a C++ Library in C# (dotnet core 3.1 on debian linux) and struggling with DllImport the following method (taken from the libs documentation):
HRESULT __stdcall InitializeEngine(
BSTR CustomerProjectID,
BSTR LicensePath,
BSTR LicensePassword,
BSTR FREngineDataFolder,
BSTR FREngineTempFolder,
VARIANT_BOOL IsSharedCPUCoresMode,
IEngine** Engine);
Update: Looking further in the header files, the COM Types are typedefs. Therefore the actual signature looks something like this:
int __stdcall InitializeEngine(
wchar_t* CustomerProjectID,
wchar_t* LicensePath,
wchar_t* LicensePassword,
wchar_t* FREngineDataFolder,
wchar_t* FREngineTempFolder,
short IsSharedCPUCoresMode,
IEngine** Engine);
My Import currently looks like this:
[DllImport("FREngine", CallingConvention = CallingConvention.StdCall)]
extern static int InitializeEngine(
[MarshalAs(UnmanagedType.LPWStr)]string customerProjectID,
[MarshalAs(UnmanagedType.LPWStr)]string licensePath,
[MarshalAs(UnmanagedType.LPWStr)]string licensePassword,
[MarshalAs(UnmanagedType.LPWStr)]string frEngineDataFolder,
short isSharedCPUCoresMode,
ref IntPtr engine);
But this does not work. Is this the correct translation of the method signature?