Re: How To: C++ DLL function returns Structure Array to VB .NET
- From: Mattias Sjögren <mattias.dont.want.spam@xxxxxxxx>
- Date: Sat, 16 Sep 2006 13:36:15 +0200
NotesInfo mytest(char *fHMM, char *fWaveUserQuery)
{
NotesInfo *Score;
Score = new NotesInfo[2];
Score[0].StartTime = 0;
Score[0].EndTime = 1;
Score[0].Note = 60;
Score[1].StartTime = 2;
Score[1].EndTime = 3;
Score[1].Note = 70;
return *Score;
}
This doesn't return an array, it returns a single NotesInfo instance.
Plus it leaks memory since you don't have any way of releasing the
array memory after the function returns.
I suggest you rewrite it to return the array via output parameters.
Mattias
--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
.
- Follow-Ups:
- References:
- Prev by Date: How To: C++ DLL function returns Structure Array to VB .NET
- Next by Date: LDAP Auth Problem - COM interop
- Previous by thread: How To: C++ DLL function returns Structure Array to VB .NET
- Next by thread: Re: How To: C++ DLL function returns Structure Array to VB .NET
- Index(es):
Relevant Pages
|
Loading