Pinvoke- to call a function with pointer to pointer to pointer parameter

Posted by jambodev on Stack Overflow See other posts from Stack Overflow or by jambodev
Published on 2012-12-19T17:02:24Z Indexed on 2012/12/19 17:02 UTC
Read the original article Hit count: 399

Filed under:
|
|
|
|

complete newbe in PInvoke.

I have a function in C with this signature:

    int addPos(int init_array_size, int *cnt, int *array_size, PosT ***posArray, 
               PosT ***hPtr, char *id, char *record_id, int num, char *code, char *type, 
               char *name, char *method, char *cont1, char *cont2, char *cont_type, 
               char *date1, char *date_day, char *date2, char *dsp, char *curr, 
               char *contra_acc, char *np, char *ten, char *dsp2, char *covered, 
               char *cont_subtype, char *Xcode, double strike, int version, 
               double t_price, double long, double short, double scale, 
               double exrcised_price, char *infoMsg);

and here is how PosT looks like:

    typedef union pu
    {
      struct  dpos   d;
      struct  epo    e;
      struct  bpos   b;
      struct  spos   c;
    } PosT ;

my questions are:

1- do I need to define a class in CSharp representing PosT?

2- how do I pass PosT ***posArray parameter across frm CSharp to C?

3- How do I specify marshaling for it all?

I Do appreciate your help

© Stack Overflow or respective owner

Related posts about c#

Related posts about pointers