dll interoperability : how to write to a buffer ?

  • Thread starter Thread starter Vincent Schmid
  • Start date Start date
V

Vincent Schmid

Hello,

We are trying to use a dll within a vb project. We have managed to declare
and implement all the standard functions exported by the dll, but one.

The dll is written in Delphi and it declares a callback :

RequestProc : procedure(PData:pointer; DataSize:dword); stdcall;

We have declared a corresponding sub in vb :

Sub Test(ByVal Param1 As String, ByVal Param2 As Integer)

We have checked that the dll can call this Sub without problem (Altough it
might not be the right declaration). Now, we need to write a string at the
address given by the PData pointer. To be clear : the dll gives us a pointer
to a buffer which is created by the dll, and we must write to this buffer.

We haven't been able to find any syntax wich would allow such a thing.

Is this simply possible in vb.net ? If yes, how should we do that ?


Any suggestion or reference would be greatly appreciated,
Best regards,
V. Schmid
 
Is this simply possible in vb.net ? If yes, how should we do that ?

Yes, but it would be easier if you change the parameter type to an
IntPtr. You can then use the Marshal class to copy data to that memory
buffer.



Mattias
 
Mattias,

Thank you for your reply, I'm going to try it again...

Sincerely,
Vincent
 
Back
Top