convert eVC++ prototype to VB.NET

E

Eric BOUXIROT

hi,

i must convert all of these eVC++ prototypes to use with VB.NET....

DLLEXPORT long F_BDO_MessageBoxOK(char *IN_title, char *IN_msg );
DLLEXPORT long F_BDO_MessageBoxOUINON(char *IN_title, char *IN_msg );
DLLEXPORT long F_BDO_CalculAXplusB(short int *IN_Tab_entree ,int IN_taille
,
double *OUT_Tab_sortie_freq ,
double *OUT_Tab_sortie, double IN_A,
double IN_B, double IN_Te, double OUT_Elt_max[2],
double OUT_Elt_min[2] );
DLLEXPORT long F_BDO_determine_A_et_B(int IN_Point1[2] ,int IN_Point2[2] ,
double *OUT_A, double *OUT_B );
DLLEXPORT long F_BDO_trouve_maximum(short int *IN_Tab_entree ,int IN_taille
,
short int IN_seuil, double IN_A,
double IN_B, int *OUT_n_max,
double *OUT_y_max );
DLLEXPORT long F_BDO_trouve_max_et_min(double *IN_Tab_entree ,int IN_taille
,
double *OUT_max, double *OUT_min);
DLLEXPORT long F_BDO_conv_lineaire_dbl(double *IN_Tab_entree,int IN_taille,
double *OUT_Tab_sortie);
DLLEXPORT long F_BDO_conv_dbl_dba(double *IN_Tab_entree,int IN_taille,
double *OUT_Tab_sortie);
DLLEXPORT long F_BDO_conv_dbl_dba_bf(double *IN_Tab_entree,double
*IN_Tab_freq,
int IN_taille,double *OUT_Tab_sortie);
DLLEXPORT long F_BDO_trouver_indice_harmonique_roue(double
*IN_Tab_entree,double *IN_Tab_freq,
int IN_taille,double freq_theorique,
double seuil_freq,double seuil_ampl,
unsigned short int *OUT_Tab_ind_harmonique);
DLLEXPORT char F_BDO_init(void);
DLLEXPORT void F_BDO_close(void);
DLLEXPORT char F_BDO_start(void);
DLLEXPORT char F_BDO_stop(void);
DLLEXPORT char F_BDO_getSample(char *pBuf,long *cbDone);

what rules i can apply to correctly convert datas type parameters ?

thank a lot ...
 
A

Alex Feinman [MVP]

Almost straightforward.

The only catches here are:
long becomes Int32 (or Integer)
char* needs to be passed as Byte() and you will have to convert strings
manually by using Encoding.ASCII.GetBytes(myString + Chr(0))
double* is Double()
short int * is Int16()
double cannot be passed down at all. you can only pass it ByRef and your c++
function will need to be modified or a wrapper written around it.
char as return value stays Char (or Byte can be used)
 
E

Eric BOUXIROT

thank a lot but is there any software to automaticaly convert C API to
VB.NET ?
i have search with google without answer but...

thanks

Alex Feinman said:
Almost straightforward.

The only catches here are:
long becomes Int32 (or Integer)
char* needs to be passed as Byte() and you will have to convert strings
manually by using Encoding.ASCII.GetBytes(myString + Chr(0))
double* is Double()
short int * is Int16()
double cannot be passed down at all. you can only pass it ByRef and your
c++ function will need to be modified or a wrapper written around it.
char as return value stays Char (or Byte can be used)

--
Alex Feinman
---
Visit http://www.opennetcf.org
Eric BOUXIROT said:
hi,

i must convert all of these eVC++ prototypes to use with VB.NET....

DLLEXPORT long F_BDO_MessageBoxOK(char *IN_title, char *IN_msg );
DLLEXPORT long F_BDO_MessageBoxOUINON(char *IN_title, char *IN_msg );
DLLEXPORT long F_BDO_CalculAXplusB(short int *IN_Tab_entree ,int
IN_taille ,
double *OUT_Tab_sortie_freq ,
double *OUT_Tab_sortie, double IN_A,
double IN_B, double IN_Te, double OUT_Elt_max[2],
double OUT_Elt_min[2] );
DLLEXPORT long F_BDO_determine_A_et_B(int IN_Point1[2] ,int IN_Point2[2]
,
double *OUT_A, double *OUT_B );
DLLEXPORT long F_BDO_trouve_maximum(short int *IN_Tab_entree ,int
IN_taille ,
short int IN_seuil, double IN_A,
double IN_B, int *OUT_n_max,
double *OUT_y_max );
DLLEXPORT long F_BDO_trouve_max_et_min(double *IN_Tab_entree ,int
IN_taille ,
double *OUT_max, double *OUT_min);
DLLEXPORT long F_BDO_conv_lineaire_dbl(double *IN_Tab_entree,int
IN_taille,
double *OUT_Tab_sortie);
DLLEXPORT long F_BDO_conv_dbl_dba(double *IN_Tab_entree,int IN_taille,
double *OUT_Tab_sortie);
DLLEXPORT long F_BDO_conv_dbl_dba_bf(double *IN_Tab_entree,double
*IN_Tab_freq,
int IN_taille,double *OUT_Tab_sortie);
DLLEXPORT long F_BDO_trouver_indice_harmonique_roue(double
*IN_Tab_entree,double *IN_Tab_freq,
int IN_taille,double freq_theorique,
double seuil_freq,double seuil_ampl,
unsigned short int *OUT_Tab_ind_harmonique);
DLLEXPORT char F_BDO_init(void);
DLLEXPORT void F_BDO_close(void);
DLLEXPORT char F_BDO_start(void);
DLLEXPORT char F_BDO_stop(void);
DLLEXPORT char F_BDO_getSample(char *pBuf,long *cbDone);

what rules i can apply to correctly convert datas type parameters ?

thank a lot ...
 
N

Neil Cowburn

Paul Yao has a tool for you to look at.

http://www.paulyao.com/resources/tools/pinvoke.asp


Eric BOUXIROT said:
thank a lot but is there any software to automaticaly convert C API to
VB.NET ?
i have search with google without answer but...

thanks

Alex Feinman said:
Almost straightforward.

The only catches here are:
long becomes Int32 (or Integer)
char* needs to be passed as Byte() and you will have to convert strings
manually by using Encoding.ASCII.GetBytes(myString + Chr(0))
double* is Double()
short int * is Int16()
double cannot be passed down at all. you can only pass it ByRef and your
c++ function will need to be modified or a wrapper written around it.
char as return value stays Char (or Byte can be used)

--
Alex Feinman
---
Visit http://www.opennetcf.org
Eric BOUXIROT said:
hi,

i must convert all of these eVC++ prototypes to use with VB.NET....

DLLEXPORT long F_BDO_MessageBoxOK(char *IN_title, char *IN_msg );
DLLEXPORT long F_BDO_MessageBoxOUINON(char *IN_title, char *IN_msg );
DLLEXPORT long F_BDO_CalculAXplusB(short int *IN_Tab_entree ,int
IN_taille ,
double *OUT_Tab_sortie_freq ,
double *OUT_Tab_sortie, double IN_A,
double IN_B, double IN_Te, double OUT_Elt_max[2],
double OUT_Elt_min[2] );
DLLEXPORT long F_BDO_determine_A_et_B(int IN_Point1[2] ,int IN_Point2[2]
,
double *OUT_A, double *OUT_B );
DLLEXPORT long F_BDO_trouve_maximum(short int *IN_Tab_entree ,int
IN_taille ,
short int IN_seuil, double IN_A,
double IN_B, int *OUT_n_max,
double *OUT_y_max );
DLLEXPORT long F_BDO_trouve_max_et_min(double *IN_Tab_entree ,int
IN_taille ,
double *OUT_max, double *OUT_min);
DLLEXPORT long F_BDO_conv_lineaire_dbl(double *IN_Tab_entree,int
IN_taille,
double *OUT_Tab_sortie);
DLLEXPORT long F_BDO_conv_dbl_dba(double *IN_Tab_entree,int IN_taille,
double *OUT_Tab_sortie);
DLLEXPORT long F_BDO_conv_dbl_dba_bf(double *IN_Tab_entree,double
*IN_Tab_freq,
int IN_taille,double *OUT_Tab_sortie);
DLLEXPORT long F_BDO_trouver_indice_harmonique_roue(double
*IN_Tab_entree,double *IN_Tab_freq,
int IN_taille,double freq_theorique,
double seuil_freq,double seuil_ampl,
unsigned short int *OUT_Tab_ind_harmonique);
DLLEXPORT char F_BDO_init(void);
DLLEXPORT void F_BDO_close(void);
DLLEXPORT char F_BDO_start(void);
DLLEXPORT char F_BDO_stop(void);
DLLEXPORT char F_BDO_getSample(char *pBuf,long *cbDone);

what rules i can apply to correctly convert datas type parameters ?

thank a lot ...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top