-
December 18th, 2012, 09:39 PM
#1
Dynamic memory allocation from dll
Hi,
I have a C++ DLL. This DLL contains a function func ( float **arg1, int &nbArg1, int **arg2, int &nbArg2 ); This function do dynamic memory allocation to allocate enough of memory for arg1 and arg2. I'm looking for a way to call this function in a C## program and be able to access data in arg1 and arg2.
Thank you
-
December 19th, 2012, 10:23 PM
#2
Re: Dynamic memory allocation from dll
You'll need to use pointers in unsafe mode. This link should be illuminating: http://msdn.microsoft.com/en-us/libr...=vs.71%29.aspx
Best Regards,
BioPhysEngr
http://blog.biophysengr.net
--
All advice is offered in good faith only. You are ultimately responsible for effects of your programs and the integrity of the machines they run on.
-
December 20th, 2012, 09:40 AM
#3
Re: Dynamic memory allocation from dll
Originally Posted by BioPhysEngr
Thank you for your information. I have finally found a walk around by adding function in the dll that can return size of returned structures. In this way I preallocate arrays. This walk around works in the current situation because I have control on both C++ dll and C## code.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|