By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,231 Members | 1,636 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,231 IT Pros & Developers. It's quick & easy.

dll interoperability : how to write to a buffer ?

P: n/a
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

Nov 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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 Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Nov 20 '05 #2

P: n/a
Mattias,

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

Sincerely,
Vincent
"Mattias Sjögren" <ma********************@mvps.org> a écrit dans le message
de news:Oe**************@TK2MSFTNGP11.phx.gbl...
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 Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.

Nov 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.