これはヘッダーファイルの内容です。エラーの取得 "保護されたメモリの読み取りまたは書き込みを試みました"
/// Creates a new file geodatabase in the specified location.
/// @param[in] path The location where the geodatabase should be created.
/// @param[out] geodatabase A reference to the newly-created geodatabase.
/// @return A long integer indicating whether the method finished successfully.
EXT_FILEGDB_API long CreateGeodatabase(const std::wstring& path, Geodatabase& geodatabase);
これは私のdllimportの外観です。
[DllImport("FileGDBAPI.dll", EntryPoint = "#49", SetLastError=true, CallingConvention=CallingConvention.Winapi)]
public static extern int CreateGeodatabase([MarshalAs(UnmanagedType.LPStr)]string path, ref IntPtr geodatabase);
..これはこれを使用しているコードです。
IntPtr Geodatabase = IntPtr.Zero;
FileGDBAPI_wrapper.CreateGeodatabase("c:\temp\testGDB.gdb", ref Geodatabase);
私は間違っていますか?
これを確認しましたか? http://stackoverflow.com/questions/4402280/trouble-with-cc-dllimport-attempted-to-read-or-write-protected-memory –
これは何らかの形で関係しているかもしれません。あなたはアットマークを"c:\ temp \ testGDB.gdb"となるので、 "\ t" -sはタブにならないかもしれません...おそらくあなたが得ているエラーはライブラリのバグです。 –
@記号が機能しませんでした –