Dynamic memory allocation from dll
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Dynamic memory allocation from dll

Hybrid View

  1. #1
    Join Date
    Aug 2001
    Posts
    81

    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

  2. #2
    Join Date
    Feb 2011
    Location
    United States
    Posts
    1,006

    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.

  3. #3
    Join Date
    Aug 2001
    Posts
    81

    Re: Dynamic memory allocation from dll

    Quote Originally Posted by BioPhysEngr View Post
    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

    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
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center