Using unsafe.Pointer instead of the C type: C.device_t solved the problem:

func Open() {
   var dev unsafe.Pointer
   C.open(&dev)
}


On Saturday, September 25, 2021 at 12:13:04 PM UTC-3 Elemer Pixard wrote:

> Correction: The Go function is:
> func Open() {
>   var dev *C.device_t
>   C.open(&dev)
> }
>
>
> On Saturday, September 25, 2021 at 10:59:45 AM UTC-3 Elemer Pixard wrote:
>
>> I am trying to call the following C function (simplified version from a C 
>> library) from Go,
>> and I got compiler errors:
>> typedef void device_t;
>> void open(device_t **dev) {
>> }
>>
>> *Go Function*:
>> func Open() {
>>    var dev C.device_t
>>    C.open(&&dev)
>> }
>>
>> *Compiler (v1.17) error:*
>> cannot use _cgo0 (type **_Ctype_void) as type *unsafe.Pointer in argument 
>> to _Cfunc_open
>>
>> How to fix that?
>> Regards.
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/d8ea9cef-4362-458b-afe0-1b07dfbeaf3an%40googlegroups.com.

Reply via email to