This is what is in the header file.
/// 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);
This is what my dllimport looks like.
[DllImport("FileGDBAPI.dll", EntryPoint = "#49", SetLastError=true, CallingConvention=CallingConvention.Winapi)]
public static extern int CreateGeodatabase([MarshalAs(UnmanagedType.LPStr)]string path, ref IntPtr geodatabase);
..and this is the code thats using it.
IntPtr Geodatabase = IntPtr.Zero;
FileGDBAPI_wrapper.CreateGeodatabase("c:\temp\testGDB.gdb", ref Geodatabase);
What am I doing wrong?
I see two possible problems:
std::wstringclass, and not a c style null terminated stringI don’t think you can fix the second problem easily without changing the API on the C++ side