i have a problem with a dllimport, first the C++ code:
extern "C" {
__declspec(dllexport) int wmain(char* configr, char* path)
{
ILoggerPtr logger;
try
{
_bstr_t config(configr);
_bstr_t srcFile(path);
}
My C# Code:
[DllImport(@"Test.dll")]
static extern int wmain(string config, string path);
The call for to C++:
string path = "c:\\bmp\\" + im.ID_MOVIMENTO + "_gray.bmp";
temp.Save(path, System.Drawing.Imaging.ImageFormat.Bmp);
int k = wmain("Brasil", path);
Oks, the problem, in the first conversion in C++ char* to _bstr_t have the error: An unhandled exception of type 'System.AccessViolationException' occurred in CarregadorFotos.exe
Someone have any idea to manage this error?