hi all,

i'm looking for some help not totally about asm.

This is my issue:

i have a good asm dll that communicate in rs232 with an external device. The dll read continuosly some parameters from the device, putting them into a memory space.

Now I would like to read that parameters calling the dll from VB.
Maybe someone of you know if it's possible.
I've tought to pass in some way to my asm dll the data pointer of another mirror-buffer in my VB application.
I think i have to pass something like ds:edx to get the data into this space.
So someone know if there's a way to create and pass this pointer it in VB?

Many thanks B7
Posted on 2002-03-19 14:26:08 by Bit7
A couple of ways to do this. Neither are elegant, but we are talking about VB right? LOL

You need to define either an array or a char string in VB and pass it to the DLL (I.E. ByVal or ByRef). You also will need to pass (ByRef) a variable to the DLL so that when it's done, it can put in how many things it loaded into the array/string.
It all depends on what you are doing, just reading/writing chars, I would go for the char string approach. If it's a mix of things, use the array.

Another approach is filemapping. That allows you large memory sharing. But you'll need to read some.
Posted on 2002-03-19 16:35:27 by sceptor
sceptor


many thanks!

I will try tomorrow :)

B7
Posted on 2002-03-20 15:42:38 by Bit7
AS I recall, the char string trick doesn't work on latter versions of VB, as it converts strings to and from Unicode (or mauls the data in some other mannor).

Last time I needed some 'heap' in VB (space for a string returned from a Windows API) I had to use an array of byte types, one byte per character, so to receive a 128 byte string I needed to declare

Dim sString(1 To 129) As Byte ' extra byte for trailing zero.

This array was then passed ByRef to the API.
Posted on 2002-03-20 20:01:06 by Ernie
When you pass a string byval to a dll, it is converted to a "C" type string, and then the address of the first char. of this "C" type string is passed to the dll.

When you pass a string byref to a dll, it is not converted to a "C" type string, vb just simply passes the address of the first char. of the "raw" vb string to the dll.
Posted on 2002-03-21 07:25:46 by sceptor
thanks again

B7
Posted on 2002-03-22 07:39:47 by Bit7