Last active
August 25, 2015 22:52
-
-
Save xlab/1b001d09150f44d8e86e to your computer and use it in GitHub Desktop.
How CGO sees muti arrays when used as vars and as function params.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| char a1; // type of a1 is C.char | |
| char *a2; // type of a2 is *C.char | |
| char a3[1]; // type of a3 is [1]C.char | |
| char a4[1][2]; // type of a4 is [1][2]C.char | |
| char a5[1][2][3]; // type of a5 is [1][2][3]C.char | |
| char *a6[1][2][3]; // type of a6 is [1][2][3]*C.char | |
| char **a7[1][2][3]; // type of a7 is [1][2][3]**C.char | |
| char ***a8[1][2]; // type of a8 is [1][2]***C.char | |
| char *a9[1][2]; // type of a9 is [1][2]*C.char | |
| char **a10[1]; // type of a0 is [1]**C.char | |
| char *a11[1]; // type of a1 is [1]*C.char | |
| void b1(char a1) {} // as type C.char in _Cfunc_b1 | |
| void b2(char *a2) {} // as type *C.char in _Cfunc_b2 | |
| void b3(char a3[1]) {} // as type *C.char in _Cfunc_b3 | |
| void b4(char a4[1][2]) {} // as type *[2]C.char in _Cfunc_b4 | |
| void b5(char a5[1][2][3]) {} // as type *[2][3]C.char in _Cfunc_b5 | |
| void b6(char *a6[1][2][3]) {} // as type *[2][3]*C.char in _Cfunc_b6 | |
| void b7(char **a7[1][2][3]) {} // as type *[2][3]**C.char in _Cfunc_b7 | |
| void b8(char ***a8[1][2]) {} // as type *[2]***C.char in _Cfunc_b8 | |
| void b9(char *a9[1][2]) {} // as type *[2]*C.char in _Cfunc_b9 | |
| void b10(char **a10[1]) {} // as type ***C.char in _Cfunc_b10 | |
| void b11(char *a11[1]) {} // as type **C.char in _Cfunc_b11 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment