Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21090

Passing Array of Strings Between ViB and C

$
0
0
Hi all,

I would be very gratefull if you could help me in solving the following problem.

I've developed a C library which exports a function which use as input parameter an array of strings. I have to invoke this function from VB. With the help of google I've discovered the SAFEARRAY. I am able to pass the parameters from VB to C but I have no idea on how to access to the SAFEARRAY type.

For instance, let us suppose to have the following C function:

long __declspec (dllexport) __stdcall TryArrayString(SAFEARRAY **ppsaMyArray)
{

...

return 0;
}


Let us suppose that I have the following code in VB:

Dim s(4) As String
s(0) = "Pippo"
s(1) = "Pluto"
s(2) = "Paperino"
s(3) = "Minnie"

Dim tmp As Long

tmp = ProvaArrayString(VarPtrStringArray(s()))


My question is: what I have to put at place of "..." in function TryArrayString for accessing the array of strings that is contained into ppsaMyArray?

Many thanks in advance for your help and best regards,

Cristina

Viewing all articles
Browse latest Browse all 21090

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>