Hi all,
how one can make visible struct and class from C/C++ to XC ?
for make array visible you just put :
extern int arr[];...and it become usable from XC.
but I have hard time to pass struct to XC.
thx
cicga
make visible struct and class from C to XC
-
- Active Member
- Posts: 51
- Joined: Tue Oct 11, 2011 4:48 pm
-
- Active Member
- Posts: 52
- Joined: Mon Oct 31, 2011 4:08 pm
Hi, it is the same as C: typedef the struct in an include (.h) file
then include it and allocate the struct in the C source:
finally you can refer to the struct data from .xc source
Code: Select all
#ifndef C_INCLUDE_H_
#define C_INCLUDE_H_
struct tagSTRUCT_NAME
{
int Param0;
char Vector[100];
};
typedef struct tagSTRUCT_NAME STRUCT_NAME;
#endif /* C_INCLUDE_H_ */
Code: Select all
#include "CHeader.h"
STRUCT_NAME Struct;
Code: Select all
#include "CHeader.h"
extern SRUCT_NAME Struct;
int main() {
Struct.Param0 = 0;
return 0;
}
-
- Active Member
- Posts: 51
- Joined: Tue Oct 11, 2011 4:48 pm
thx Lele...