J
jman0
I have developed a C++ DLL with Embedded Visual C++ 4.0. Inside it
there's a function which in the past returned a bool value, and worked
perfectly when called from a C# project.
Now, I need that function to return a DWORD value. In C++, the
function header is as follows:
extern "C" LIB_API DWORD StartRASConnection(unsigned short *Name,
unsigned short *UserName, unsigned short *Password)
where LIB_API is declared as
#ifdef MIPLIB_EXPORTS
#define LIB_API __declspec(dllexport)
#else
#define LIB_API __declspec(dllimport)
#endif
In C#, function is imported as
[DllImport("miplib.dll")]
public static extern long StartRASConnection(string nombreConn, string
usuario, string pass);
The problem is that when I call StartRASConnection, an exception is
raised. The exception text is just "NotSupportedException". I think
the problem must be on the C# side, since there's a try...catch block
on the C++ code, which catches all exceptions and then returns the
number 25000 in case one is raised. When the same try...catch block
just returned 0 in the past (when the function returned bool) there
was no "NotSupportedException" issue.
When the C++ function returned a bool, everything worked fine, which
is driving me crazy.
Where's the problem with my code?
Thanks in advance.
there's a function which in the past returned a bool value, and worked
perfectly when called from a C# project.
Now, I need that function to return a DWORD value. In C++, the
function header is as follows:
extern "C" LIB_API DWORD StartRASConnection(unsigned short *Name,
unsigned short *UserName, unsigned short *Password)
where LIB_API is declared as
#ifdef MIPLIB_EXPORTS
#define LIB_API __declspec(dllexport)
#else
#define LIB_API __declspec(dllimport)
#endif
In C#, function is imported as
[DllImport("miplib.dll")]
public static extern long StartRASConnection(string nombreConn, string
usuario, string pass);
The problem is that when I call StartRASConnection, an exception is
raised. The exception text is just "NotSupportedException". I think
the problem must be on the C# side, since there's a try...catch block
on the C++ code, which catches all exceptions and then returns the
number 25000 in case one is raised. When the same try...catch block
just returned 0 in the past (when the function returned bool) there
was no "NotSupportedException" issue.
When the C++ function returned a bool, everything worked fine, which
is driving me crazy.
Where's the problem with my code?
Thanks in advance.