Passing VB arrays to a dll written in C 
Author Message
 Passing VB arrays to a dll written in C

I 'd really really appreciate any help with this stuff.
I mostly write software in C/C++ and I have extremely
limited knowledge when it comes to VB.

I did try Dejanews first before posting. Here's the problem,

I wrote a C Dll,
void mydll(double * array1, double ** array2)

I want to call this from a VB program. It should create these
arrays, and the dll 'll only process them.

In VB I use,

Dim Array1(100) As Double
Dim Array2(10,100) As Double

My questions are,

a) How do I 'Declare' these functions in VB..?
Public Declare Sub mydll Lib "thedll" ( .. ????? )
Should I pass array names only ? Should I use ByVal as Any
or ByRef? Should I use paranthesis after array name?

b) How can I differentiate in two dimensional and single
dimensional array in VB, while I am passing them as argument.
I mean how do I let VB know about that?

c) Can I use user defined type in VB, and then use the equivalent
in C? So maybe I can use array inside a user defined type, and
then pass it 'As Any'.

Thanks a million !!
--
Noman



Tue, 13 Feb 2001 03:00:00 GMT  
 Passing VB arrays to a dll written in C

   I 'd really really appreciate any help with this stuff.
   I mostly write software in C/C++ and I have extremely
   limited knowledge when it comes to VB.

comp.lang.c isn't the right group for ``C/C++''[1] questions and
certainly not for VB questions.

[1] There is no such language.
--
"I ran it on my DeathStation 9000 and demons flew out of my nose." --Kaz

Please: do not email me copies of your posts to comp.lang.c
        do not ask me C questions via email; post them instead



Tue, 13 Feb 2001 03:00:00 GMT  
 Passing VB arrays to a dll written in C
Not very helpful, Ben. It is a valid question for either NG.

I agree, there is no language called "[1]".

Steve

Quote:


>   I 'd really really appreciate any help with this stuff.
>   I mostly write software in C/C++ and I have extremely
>   limited knowledge when it comes to VB.

>comp.lang.c isn't the right group for ``C/C++''[1] questions and
>certainly not for VB questions.

>[1] There is no such language.
>--
>"I ran it on my DeathStation 9000 and demons flew out of my nose." --Kaz

>Please: do not email me copies of your posts to comp.lang.c
>        do not ask me C questions via email; post them instead



Tue, 13 Feb 2001 03:00:00 GMT  
 Passing VB arrays to a dll written in C
Declare the array parameter as ByRef as whatever type your array is
comprised of (even a struct! Oops, I mean 'user defined type')

Call the function from VB by passing the first element of your array, like
so:

MyDllFunc MyArray(0)

Steve

Quote:

>I 'd really really appreciate any help with this stuff.
>I mostly write software in C/C++ and I have extremely
>limited knowledge when it comes to VB.

>I did try Dejanews first before posting. Here's the problem,

>I wrote a C Dll,
>void mydll(double * array1, double ** array2)

>I want to call this from a VB program. It should create these
>arrays, and the dll 'll only process them.

>In VB I use,

>Dim Array1(100) As Double
>Dim Array2(10,100) As Double

>My questions are,

>a) How do I 'Declare' these functions in VB..?
>Public Declare Sub mydll Lib "thedll" ( .. ????? )
>Should I pass array names only ? Should I use ByVal as Any
>or ByRef? Should I use paranthesis after array name?

>b) How can I differentiate in two dimensional and single
>dimensional array in VB, while I am passing them as argument.
>I mean how do I let VB know about that?

>c) Can I use user defined type in VB, and then use the equivalent
>in C? So maybe I can use array inside a user defined type, and
>then pass it 'As Any'.

>Thanks a million !!
>--
>Noman



Tue, 13 Feb 2001 03:00:00 GMT  
 Passing VB arrays to a dll written in C

Quote:

> Not very helpful, Ben. It is a valid question for either NG.

> I agree, there is no language called "[1]".

> Steve

<Jack>

Not very correct, Steve, at least for comp.lang.c.  The C language, which is
defined by ANSI/ISO 9899:1990 and NOT by Microsoft, has absolutely no support
for DLLs (which are a Windows feature and not part of any programming language
per se), or for linking with ANY other language.  Questions about DLLs and
mixing other languages with C do not belong in this newsgroup.

There are plenty of compiler specific newsgroups (microsoft.public.vc.* and
borland.public.cpp.*) dedicated to compilers which have Windows specific
extensions such as DLLs and questions about making/using them with those C
compilers belongs there.

Visual Basic on the other hand is specifically a Windows creature, and its
standard is specifically geared to Windows.  It does not adhere to any
standard except Microsoft's whim.  So I do agree that DLLs are topical in a VB
newsgroup.

</Jack>



Wed, 14 Feb 2001 03:00:00 GMT  
 Passing VB arrays to a dll written in C

Quote:
> Not very helpful, Ben.

I disagree.

Quote:
> It is a valid question for either NG.

Feel free to discuss it ad naseum in comp.lang.basic.visual; you will be
thanked, however, to refrain from making further posts on the subject to
comp.lang.c.

Quote:
> I agree, there is no language called "[1]".

There's nothing more irritating than a person being purposefully obtuse.
Ben was referring, of course, to the mythical 'C/C++' when he stated that
such does not exist.

--
(cfgwgid)



Wed, 14 Feb 2001 03:00:00 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. Passing arrays from VB to a DLL written in VC++

2. Writing DLLs and passing arrays.

3. Passing array from VB to DLL and returning array

4. passing arrays from vb dll to vb form

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

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

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

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

9. PB/DLL passing multidimensional VB arrays by pointers

10. Passing Array of data from DLL to VB

11. passing (string) arrays from VB to C-DLL and vice versa

12. Passing Multi-Dimension Arrays from VB to DLL

 

 
Powered by phpBB® Forum Software