On Monday, November 15, 2021 at 3:49:20 PM UTC-8 David Karr wrote:

>
> I'm pretty new to Go (many years in other languages).  I'm trying to use 
> cgo to use a C library we're using.
>
> I have the following line of code, which is compiling (that's been enough 
> of a struggle):
>
> status = int(C.VeProtect(C.VeObj(fpeProtect), &argsProtect))
>
> This is failing at runtime with 
> ------------------------
> panic serving [::1]:55146: runtime error: cgo argument has Go pointer to 
> Go pointer goroutine 20 [running]: net/http.(*conn).serve.func1() 
> /usr/local/go/src/net/http/server.go:1801 +0x13a panic({0xc21cc0, 
> 0xc000093700}) /usr/local/go/src/runtime/panic.go:1047 +0x262 voltagems
> /voltagefuncs.protectAndAccess.func1(0x0, 0xc0000b2960) 
> /media/sf_winhome/git/voltagego/voltagefuncs/voltagefuncs.go:71 +0x90
> ------------------------
>
> The first thing that's frustrating about this error is that I can't tell 
> which argument it's talking
> about. I would guess it's the first one, as it's more complicated than the 
> second.
>
> The type of "fpeProtect" is "C.VeFPE", and "C.VeObj" is an alias for 
> "void*".
>
> And "C.VeFPE" is defined as:
>
> type _Ctype_VeFPE *_Ctype_struct_VeFPE_st
>
> Any suggestions?
>
>
Note that all the properties of this structure are set by C functions. All 
I do is define the variable and pass a pointer to it to functions. 

Also, I saw one note that suggesting that setting "GODEBUG=cgocheck=0" 
might disable this check (not sure if that will help me or not), but I'm 
using vscode for this, and I don't know how to set the GO environment 
variables.

-- 
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/17f65eee-5da7-4194-945c-2e34f65a372an%40googlegroups.com.

Reply via email to