GC

  • Thread starter Thread starter comhari
  • Start date Start date
C

comhari

I am having a c++ dll which return me an array of bytes.

I have to use that from c#.

I wont how big the array will be.

How the deletion of array will happen.

How we should solve the problem.

Regards
hari
 
Hi Hari,

If you are able to edit and recompile your dll, you could allow your C#
code to notify the dll that it has finished with it. The dll can then do
whatever is necessary to free it.

Another way, and better if it's possible, is to have the C# pass the dll a
buffer in which to put the data. Then C# will be able to delete it in the
usual way.

If you can't change the dll then it depends on how the array was
allocated. If it was from global memory, then you should be able to use the
Win32 Api to release it.

I hope you get something from the ideas. :-)

Regards,
Fergus
 
Use ComMarshaller to handle memory free-up process for the DLL. A much
better way: write a C# wrapper for the C++ DLL.

Thanks,
Parag/-
 
Back
Top