Passing arrays from VB to a DLL written in VC++ 
Author Message
 Passing arrays from VB to a DLL written in VC++

I have a problem with VB:s arrays. I haven't been able to figure out
how they work in terms of pointers and so on. I'm writing a DLL in
VisualC++ 5.0 that I'm calling from VisualBasic 5.0.

 After messing a bit I found out that strings come as char** to C++,
but I can't get the arrays to work. I've been trying to catch a byte
array as char**, char* and an integer array as short* and short**.
These all give totally messed up values though (and the single pointer
variants leaving me with a page fault....).

Does anyone know how it works?

Thanks,
        Erik



Mon, 09 Jul 2001 03:00:00 GMT  
 Passing arrays from VB to a DLL written in VC++
    What does you call from VB look like ?
I've done this with a long array and it works
fine . Make sure you are not you aren't passing
the array by Val in your VB dll declaration .
    I can send you some sample code that I
tested with VB 6 and C++ 6 if you still need
it . (email me)
    Good Luck ,Bri
Quote:

>I have a problem with VB:s arrays. I haven't been able to figure out
>how they work in terms of pointers and so on. I'm writing a DLL in
>VisualC++ 5.0 that I'm calling from VisualBasic 5.0.

> After messing a bit I found out that strings come as char** to C++,
>but I can't get the arrays to work. I've been trying to catch a byte
>array as char**, char* and an integer array as short* and short**.
>These all give totally messed up values though (and the single pointer
>variants leaving me with a page fault....).

>Does anyone know how it works?

>Thanks,
> Erik



Mon, 09 Jul 2001 03:00:00 GMT  
 Passing arrays from VB to a DLL written in VC++
When passing the array from VB, it should be passes as the 1st element
ByRef. Your C module can then pick it up as a char* ie:

Declare Sub Something(ByRef ArryPointer as Any)
    .
    .
Call Somethin(MyByteArray(0))

Regards,
Mick.
 http://members.aol.com/midipapa/MONeill.htm


Quote:
>I have a problem with VB:s arrays. I haven't been able to figure out
>how they work in terms of pointers and so on. I'm writing a DLL in
>VisualC++ 5.0 that I'm calling from VisualBasic 5.0.

> After messing a bit I found out that strings come as char** to C++,
>but I can't get the arrays to work. I've been trying to catch a byte
>array as char**, char* and an integer array as short* and short**.
>These all give totally messed up values though (and the single pointer
>variants leaving me with a page fault....).

>Does anyone know how it works?

>Thanks,
> Erik



Tue, 10 Jul 2001 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

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

2. Problem Paasing 2-D Array using SAFEARRAY in DLL written with VC++ 5.0 from VB.

3. Problem Paasing 2-D Array using SAFEARRAY in DLL written with VC++ 5.0 from VB.

4. Problem Paasing 2-D Array using SAFEARRAY in DLL written with VC++ 5.0 from VB.

5. Problem Paasing 2-D Array using SAFEARRAY in DLL written with VC++ 5.0 from VB.

6. How to pass Variant Array to VB ActiveX DLL from a VC++ application

7. Need help passing a DC handle from vb to a vc++ dll

8. Passing an array (or array of a structure) from VB to VC++

9. Passing VB arrays to a dll written in C

10. Help pls re passing array to VC++ DLL

11. Passing an Array to a VC++ DLL

12. Need help passing a DC to a vc++ dll

 

 
Powered by phpBB® Forum Software