I am using a third party C++ dll which uses a function that has the following signature:
extern "C" __declspec(dllimport) int __stdcall CalcDDtable(struct ddTableDeal tableDeal,
struct ddTableResults * tablep);
The structs each contain just one fixed one dimensional array of ints (VB6 Longs). tablep will contain the results.
Had the C++ declaration been:
extern "C" __declspec(dllimport) int __stdcall CalcDDtable(int * tableDeal, int * tablep);
then the VB6 Declare statement would have been:
Declare Function CalcDDtable Lib "my3rdParty.dll"(ByRef lngTable as Long,ByRef lngResult as Long) as int
This code would be called like:
Dim lngTables(15) As Long
Dim lngResults(20) As Long
'Initialize the lngTables array...
intResult=CalcDDtabel(lngTables(0),lngResults(0))
But I am at a loss how to declare the function above since the first array is packaged in a struct that is not a pointer.
You can’t pass structures by value from VB6 to a DLL. The tableDeal structure is by value (not a pointer) so I am not sure what you can do there.
You can pass structures by reference and they can contain fixed-length arrays, so your second arg would be ok. In fact if it only contains a fixed-length array of ints, you could just pass a fixed-length VB6 long array as in the second part of your question.