tinygo/cgo
Ayke van Laethem 5c0a337c4f cgo: implement rudimentary C array decaying
This is just a first step. It's not complete, but it gets some real
world C code to parse.

This signature, from the ESP-IDF:

    esp_err_t esp_wifi_get_mac(wifi_interface_t ifx, uint8_t mac[6]);

Was previously converted to something like this (pseudocode):

    C.esp_err_t esp_wifi_get_mac(ifx C.wifi_interface_t, mac [6]uint8)

But this is not correct. C array parameters will decay. The array is
passed by reference instead of by value. Instead, this would be the
correct signature:

    C.esp_err_t esp_wifi_get_mac(ifx C.wifi_interface_t, mac *uint8)

So that it can be called like this (using CGo):

    var mac [6]byte
    errCode := C.esp_wifi_get_mac(C.ESP_IF_WIFI_AP, &mac[0])

This stores the result in the 6-element array mac.
2021-09-29 13:38:33 +02:00
..
testdata cgo: fix line/column reporting in syntax error messages 2021-09-28 18:44:11 +02:00
cgo.go builder, cgo: support function definitions in CGo headers 2021-09-28 18:44:11 +02:00
cgo_test.go builder, cgo: support function definitions in CGo headers 2021-09-28 18:44:11 +02:00
const.go cgo: implement prefix parsing 2021-05-21 17:54:13 +02:00
const_test.go cgo: implement prefix parsing 2021-05-21 17:54:13 +02:00
libclang.go cgo: implement rudimentary C array decaying 2021-09-29 13:38:33 +02:00
libclang_config.go all: remove support for LLVM 9 2021-03-04 15:46:05 +01:00
libclang_config_llvm10.go main: use LLVM 11 by default when linking LLVM dynamically 2021-01-19 08:55:57 +01:00
libclang_stubs.c main: switch to LLVM 10 2020-04-09 20:23:51 +02:00
security.go cgo: implement #cgo CFLAGS 2019-11-25 09:32:03 +01:00
security_test.go cgo: implement #cgo CFLAGS 2019-11-25 09:32:03 +01:00
sync.go cgo: refactor; support multiple cgo files in a single package 2019-05-12 10:49:15 +02:00