Article View: borland.public.cppbuilder.nativeapi
Article #1467Re: Compatibility with .NET
From: David M
Date: Thu, 09 Aug 2007 02:41
Date: Thu, 09 Aug 2007 02:41
18 lines
1643 bytes
1643 bytes
> If I go with the latter, then how does memory management > work? My function needs to return a string of characters > to the caller, how should this memory be allocated and freed? Often this is solved by having two methods or being able to call the one method twice - the first call calculates how much memory is needed and the second uses it. That way the caller can allocate memory themselves and pass the pointer in. I don't know how this works for .net calling a DLL though, presumably you can manually allocate and free memory in unsafe code in .net? Another option would be to have your DLL return a handle it can then use later to free the memory when the caller requests it. Cheers, David
Technical Details
Message-ID:
<46ba7ed5$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<46ba41a9@newsgroups.borland.com> <46ba70cc$1@newsgroups.borland.com> <46ba7cf7$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,98d274f81ea99207 X-Google-Attributes: gid10cc67,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit From: "David M" <vintagedave@gmail.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <46ba41a9@newsgroups.borland.com> <46ba70cc$1@newsgroups.borland.com> <46ba7cf7$1@newsgroups.borland.com> Subject: Re: Compatibility with .NET Date: Thu, 9 Aug 2007 12:41:25 +1000 Lines: 20 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.3138 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3138 X-RFC2646: Format=Flowed; Original NNTP-Posting-Host: 203.24.135.146 Message-ID: <46ba7ed5$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1186627285 203.24.135.146 (8 Aug 2007 19:41:25 -0700) Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail