06-27-2006 09:56 PM
06-28-2006 12:38 AM
When calling DLLs it is always the best to have the caller allocate the buffers, pass a pointer to the DLL and let the DLL read or write to that buffer. Having the DLL allocate a buffer is somewhat cumbersome to pass back to any caller if you want the caller to be able to directly access that buffer too. And you need to provide a deallocation routine in your DLL as well since you can't assume that the memory management of your DLL is done in exactly the same way than in the caller and therefore memory always must be deallocated by the entity that created it. And since you are at it adding a deallocater function to your DLL, you would also be good advised to write accessor functions too for reading and writing to/from the buffer.
@mchips wrote:I have a C DLL which takes a pointer and create a buffer then writes data to it and let me know the size of it. I then have to read the data from the buffer. I think Call Library Function let you pass in a pointer. What do I write to the pointer and where is the buffer created? How do I read it?
06-28-2006 08:23 AM
06-28-2006 08:43 AM
06-28-2006 09:00 AM
06-28-2006 09:20 AM
06-28-2006 02:07 PM