私は現在、C# (debian linux の dotnet core 3.1) で C++ ライブラリのラッパー クラスに取り組んでおり、次のメソッド (libs ドキュメントから取得) の DllImport に苦労しています。
HRESULT __stdcall InitializeEngine(
BSTR CustomerProjectID,
BSTR LicensePath,
BSTR LicensePassword,
BSTR FREngineDataFolder,
BSTR FREngineTempFolder,
VARIANT_BOOL IsSharedCPUCoresMode,
IEngine** Engine);
更新: ヘッダー ファイルをさらに調べると、COM 型は typedef です。したがって、実際の署名は次のようになります。
int __stdcall InitializeEngine(
wchar_t* CustomerProjectID,
wchar_t* LicensePath,
wchar_t* LicensePassword,
wchar_t* FREngineDataFolder,
wchar_t* FREngineTempFolder,
short IsSharedCPUCoresMode,
IEngine** Engine);
私のインポートは現在次のようになっています。
[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);
しかし、これはうまくいきません。これはメソッド シグネチャの正しい翻訳ですか?