all groups > dotnet compact framework > october 2004 >
You're in the

dotnet compact framework

group:

eVC 4 DLL & VB .NET ERROR


eVC 4 DLL & VB .NET ERROR Antoni Mass? Mola via .NET 247
10/31/2004 3:56:36 AM
dotnet compact framework:
Hi,

I've created a DLL using eVC 4.

//C++ Code

__declspec(dllexport)
CString ShowLastError ()
{

return _T("Test");

}

In my .def file I export the function:

ShowLastError

In my VB .NET

<DllImport("test.DLL")> Public Function ShowLastError() As String
End Function

When I execute the VB .NET app and call the function I get this error: NotSupportedException

I just want to be able to call a function in a eVC 4 DLL and return a string to the VB .NET app.

Any ideas?

Thanks

--------------------------------
From: Antoni Mass? Mola

-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)

Re: eVC 4 DLL & VB .NET ERROR Chris Tacke, eMVP
10/31/2004 9:48:48 AM
Yes, use a TCHAR*, not a class.

I'd also not return it, returning string is rarely a good idea. If you want
to get a string back, pass in an allocated buffer that the eVC fills with
your data. To return a string, eVC will have to allocate the memory for it
and then you run into problems with getting it unallocated.

--
<ctacke/>
www.OpenNETCF.org
Your CF searches start and end here


[quoted text, click to view]

AddThis Social Bookmark Button