Invalid argument exception when calling DLL in C


I'm trying to call a C function from but I get an argument exception on a parameters that is a structure containing another structure, I'm sure that exception come from that parameter because if I remove it, the call is a success.

So i have my structure in C :

typedef struct Point3DTag  {double x, y, z ; } Point3D;
typedef struct coordonnees_verinsTag{
    Point3D pieds[30];
    Point3D tetes[30];

And my function :

void __stdcall articulation_droite2(double *corps2_to_corps1,
                         coordonnees_verins *coordonneesVerins,
                         double* longueurs,
                         int* validite_verins,
                         double precision,
                         int nb_iter_max,
                         double dist_pieds_centreRotation,
                         int* code_retour){

I got the "same structure" in my code :

Public Structure Point3D
    Public x As Double
    Public y As Double
    Public z As Double
End Structure

Public Structure coordonnees_verins_art
    Public pieds() As Point3D
    Public tetes() As Point3D
End Structure

I init my array before calling the DLL :

Dim VerinsVirtuels As coordonnees_verins_art
ReDim Preserve VerinsVirtuels.pieds(29)
ReDim Preserve VerinsVirtuels.tetes(29)

Call articulation_droite2(cA2cB_temp(0), _
                                    VerinsVirtuels, _
                                    topo_longueurs(0), _
                                    valid(0), _
                                    0.0001, _
                                    nb_iter_max, _
                                    Dist_piedsVA_centreRot, _

Exception de HRESULT : 0x80070057 (E_INVALIDARG)

I think there is a problem when declaring this structure.... Any Idea ?

asked on Stack Overflow Apr 15, 2019 by Toto NaBendo • edited Apr 15, 2019 by Ahmed Abdelhameed

0 Answers

Nobody has answered this question yet.

User contributions licensed under CC BY-SA 3.0