|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Data type conversion COM dll in VB. NetI created ATL dll in vc++. One of the function has datatype as WCHAR*. I am rferring this dll in .net, .net automatically converts this to interop dll and the signature for the method WCHAR* is changed to ushort. I actually have a string in WCHAR* variable. since it is ushort in .net i am getting some integer value when made a call. My code: VC++ idl file HRESULT fun1([in]ULONG nVen,[out,retval] WCHAR* retval); and the functions signature are same as above. When refeered the dll in .net, the interop dll method is shown as fun1(ByVal nVen As UInteger, ByRef retval As UShort) Kindly help me how to get string in .net signature. Tx in advance >I am rferring this dll in .net, .net automatically converts this to interop You can't return a string with a WCHAR* retval parameter. You need an>dll and the signature for the method WCHAR* is changed to ushort. >I actually have a string in WCHAR* variable. since it is ushort in .net i am >getting some integer value when made a call. extra level of indirection for that, WCHAR**. You should also mark it with the string attribute. The following should be imported correctly by Tlbimp HRESULT fun1([in]ULONG nVen,[string,out,retval] WCHAR** retval); Mattias -- Mattias Sjögren [C# MVP] mattias @ mvps.org http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com Please reply only to the newsgroup. |
|||||||||||||||||||||||