VB5: Passing Arrays to a DLL and back 
Author Message
 VB5: Passing Arrays to a DLL and back

    Under Visual Basic 5 (learning edition) how can I pass an array of
integers (either entered or predefined) to a VC++ DLL and have the DLL
say add 1 to each digiit and return the modified array to VB to be
displayed on screen.  I can do this with simple single integers or
doubles or longs etc. but cannot get this to work for a single
dimensional array of elements.  If you can help please e-mail.  Thanks.

- James - JC -



Mon, 18 Dec 2000 03:00:00 GMT  
 VB5: Passing Arrays to a DLL and back

Quote:

>     Under Visual Basic 5 (learning edition) how can I pass an array of
> integers (either entered or predefined) to a VC++ DLL and have the DLL
> say add 1 to each digiit and return the modified array to VB to be
> displayed on screen.  I can do this with simple single integers or
> doubles or longs etc. but cannot get this to work for a single
> dimensional array of elements.  If you can help please e-mail.

Ok

The DLL only needs to receive the address of the FIRST element of an
array.

So if you have an array of "MyArray(10) of Double" in the calling
program and the data type used to manipulate the array in the DLL was
the same then it only needs to be called like this:

Call MyDllFunction (myarray(0))

and the declaration for this DLL function in VB would be similar to
this.

Declare Sub MyDllFunction Lib "MyDllFile" (ByRef AnArray as Double)

Because arrays are stored contiguously (did i spell that right) in
visual basic the DLL only needs to know where the array starts (the
first element).

Peter Brooks



Tue, 19 Dec 2000 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Passing array from ASP (VBScript) to DLL and back

2. Passing Array to Session Variable Then back to Array

3. Passing array's from vb5 to a DLL

4. How to pass a big array from VB5 to VC5++ DLL

5. Passing large arrays to VC5.0 dll from VB5.0

6. passing vb5 arrays of strings to a vc++ 5 C dll

7. VB5 dll - passing array to help

8. VB5 dll - passing array to

9. Passing large binary arrays between VB5 and C/C++ DLLs

10. Passing a variant array from asp to a cls and back

11. pass an array back from function

12. HELP: Passing an Array back in a function

 

 
Powered by phpBB® Forum Software