[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework

Re: In VB 'PInvoke cannot return varients' message wrapping C++ li

Raymond

10/17/2008 8:25:00 AM

I am also experiencing the same problem. The DLL is returning a VARIANT. I
have turned on "Option Strict", but the exception still occurs. Can anyone
help?


"Mattias Sjögren" wrote:

>
> >So, basically the function takes 2 IntPtrs, one of the ByReference. So I
> >wrote my VB code like this:
> > Declare Auto Function KAllocCamera Lib "DCSPro4SLR.dll" Alias
> >"KPDCAllocCameraIterator" (ByVal inManagerRef As IntPtr, ByRef outRef As
> >IntPtr)
>
> You forgot to specify a return type, so it defaults to Object which
> marshals as a VARIANT by default.
>
> The solution is to
> 1) Turn on Option Strict so this never happens again
> 2) Specify the correct return type
>
>
>
>
> Mattias
>
> --
> Mattias Sjögren [MVP] mattias @ mvps.org
> http://www.msjogren.n... | http://www.dotneti...
> Please reply only to the newsgroup.
>