Thanks for your reply. I came across a similar solution today, I made a 
struct which is visible outside the package and use a private field myApp 
C.MyAppPtr to hide the C type.
I still wondering why the uintptr version works but shows a warning 
"possible misuse of unsafe.pointer", CGO documentation is not very clear to 
me about the intricacies of type conversions between Go and C.

Cheers

Tamás Gulácsi schrieb am Donnerstag, 8. Juli 2021 um 16:52:01 UTC+2:

> Use *C.MyAppPtr on Go side, don't hide it behind an uintptr.
>
> snmed a következőt írta (2021. július 7., szerda, 19:47:44 UTC+2):
>
>>
>> Hi all
>>
>> Once again I have a 3th party library which looks like this example: 
>> https://play.golang.org/p/Ue9yQ8s8Ymq and I need it to integrate in our 
>> go tool. The example is working but is still get the warning "
>> possible misuse of unsafe.Pointer". 
>>
>> So my questions are:
>>
>>    1. Can I use uintptr to hold the void pointer and pass it around go 
>>    functions?
>>    2. Can I ignore the warning "possible misuse of unsafe.pointer"?
>>    3. If not, what would be the proper approach for this example?
>>
>> Any help is much appreciated...
>> Sandro
>>
>>
>>

-- 
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/d4a60409-e9e1-4bba-b09d-34c03876eef9n%40googlegroups.com.

Reply via email to