PC Review


Reply
Thread Tools Rate Thread

Allocating memory in a .NET C++ DLL

 
 
=?Utf-8?B?U2NvdHQ=?=
Guest
Posts: n/a
 
      30th Jul 2004
I've created a .NET DLL using Visual Studio 2003 which will be referenced by a C# program. I'm able to link the two together just fine now and make calls. The problem is I need the DLL to allocate memory and pass it back to the C# program.

I can't see to use either new or malloc inside that DLL though as the normal libraries aren't compiled in. Sorry if this is a FAQ, but I'd definitely appreciate it if someone can help me work this out.
 
Reply With Quote
 
 
 
 
Mattias Sjögren
Guest
Posts: n/a
 
      31st Jul 2004

Are you using managed or unmanaged C++? How are you calling the
functions from C#?



Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
 
Reply With Quote
 
=?Utf-8?B?U2NvdHQ=?=
Guest
Posts: n/a
 
      31st Jul 2004
I created a .NET class library, which says it's using managed extension for C++. I only chose that one because I'm calling from C#, which is .NET, so it seemed to make sense. If there's a better choice I'm happy to switch.

From my C# program I'm doing a [DllImport ("")] of each of my functions. Right now they're each their own functions. I'd really rather the C++ library expose a class that I can call from C#, but I've no idea how to do that yet.


"Mattias Sjögren" wrote:

>
> Are you using managed or unmanaged C++? How are you calling the
> functions from C#?
>
>
>
> Mattias
>
> --
> Mattias Sjögren [MVP] mattias @ mvps.org
> http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
> Please reply only to the newsgroup.
>

 
Reply With Quote
 
=?Utf-8?B?U2NvdHQ=?=
Guest
Posts: n/a
 
      1st Aug 2004
The need for this just disappeared. I finally have everything working from C# directly.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Allocating memory for part of a C struct Chris Saunders Microsoft VC .NET 10 10th Oct 2008 12:43 PM
Allocating Memory? JB Windows XP Hardware 6 27th Dec 2005 03:57 PM
Set memory slider allocating program memory programmatically jd_ie Microsoft Dot NET Compact Framework 0 13th Sep 2005 11:26 AM
Allocating memory in Windows 2000 Pro Dave Jones Microsoft Windows 2000 Applications 3 17th Nov 2003 05:35 PM
FP98: Ran out of memory while allocating 0 bytes Andy Microsoft Frontpage 2 17th Aug 2003 03:48 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:22 AM.