Re: __declspec(dllexport) to return char but errors in VB6
- From: "Jason W" <jason@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 26 Jul 2005 08:36:22 -0400
Thank you for your reply!
I was switching code around and placed the FreeHGlobal in the wrong place
for my post.
changing it to this
WDINFO_LINKAGE char* getWdInfo(char* Param){
IntPtr ptr = Marshal::StringToHGlobalAnsi(S"Testing return");
char __nogc* pStr = static_cast<char*>(ptr.ToPointer());
return pStr;
Marshal::FreeHGlobal(ptr);
}
doesn't give me the error but doesn't return anything back.
Thanks in advance.
Jason
Wood
"Mattias Sjögren" <mattias.dont.want.spam@xxxxxxxx> wrote in message
news:u2TT0nbkFHA.2852@xxxxxxxxxxxxxxxxxxxxxxx
> >Can any one explain what I am doing wrong?
>
> The pointer you're returning is invalid since you just freed the
> memory it points to.
>
>
>
> Mattias
>
> --
> Mattias Sjögren [MVP] mattias @ mvps.org
> http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
> Please reply only to the newsgroup.
.
- Follow-Ups:
- Re: __declspec(dllexport) to return char but errors in VB6
- From: Mattias Sjögren
- Re: __declspec(dllexport) to return char but errors in VB6
- References:
- __declspec(dllexport) to return char but errors in VB6
- From: Jason W
- Re: __declspec(dllexport) to return char but errors in VB6
- From: Mattias Sjögren
- __declspec(dllexport) to return char but errors in VB6
- Prev by Date: Re: Debugging Unmanaged DLL With C# GUI .exe From VCPP 2003 Standard
- Next by Date: trying to insert my own icon into a Windows Forms application
- Previous by thread: Re: __declspec(dllexport) to return char but errors in VB6
- Next by thread: Re: __declspec(dllexport) to return char but errors in VB6
- Index(es):
Relevant Pages
|
Loading