Hi,
Any update about the C.CBool function supporting in CGO?
BRs,
Jian
--
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.c
Hey Guys,
I'm in trouble in the same issue. My code as the following:
test.go
```go
name := []string{"gpu0", "gpu1", "gpu2", "gpu3"}
matrix := [3][3]int{{1, 0, 0}, {3, 3, 0}, {3, 3, 2}}
C.test_settopologyresource(mod, C.CString("node1"), C.int(2),
(**C.char)(unsafe.Pointer(&name[0])
I have changed the go code into the below, but still got error. Something
else I missed?
gonameunits := []string{"gpu0", "gpu1", "gpu2", "gpu3"}
nameunits := make([]*C.char, len(gonameunits))
for i, _ := range gonameunits {
nameunits[i] = C.CString(gonameunits[i])
defe
Thanks your reply, I also used this way, but it still not work. code as the
following.
gonameunits := []string{"gpu0", "gpu1", "gpu2", "gpu3"}
nameunits := make([]*C.char, len(gonameunits))
for i, _ := range gonameunits {
nameunits[i] = C.CString(gonameunits[i])
defer C.free(u
Thank you very much for your patience and help. I got it and will try it
later. :)
在 2017年8月7日星期一 UTC+8下午3:52:43,Konstantin Khomoutov写道:
>
> On Sun, Aug 06, 2017 at 07:08:03PM -0700, jianzh...@gmail.com
> wrote:
>
> > Thanks your reply, I also used this way, but it still not work. code as
> t
Thanks! As my example on the above, I have to change the C client (change
`int** _levelmatrix` argument to `int* _levelmatrix`), right?
在 2017年8月7日星期一 UTC+8下午10:14:44,Konstantin Khomoutov写道:
>
> On Mon, Aug 07, 2017 at 06:25:48AM -0700, jianzh...@gmail.com
> wrote:
>
> > Thank you very much f
But, if I can not change the C client, how to implement it? the C client as
the following. As described on the above, I have to change the ` int**
_levelmatrix` argument, right?
bool test_settopologyresource(bsagomodule* _self, char* _nodename,
int _resourceindex, char** _nameunits, int**
Awesome! Thanks again for your kindly help. :) And I updated the code, it
works!
在 2017年8月8日星期二 UTC+8下午3:51:10,Konstantin Khomoutov写道:
>
> On Mon, Aug 07, 2017 at 08:20:01PM -0700, jianzh...@gmail.com
> wrote:
>
> [...]
> > > > > > golevelmatrix := [][]int{{1}, {3, 3}, {3, 3, 2}}
> > >
Hey Guys,
I need to call a C function with CGO, but if I release the memory of the
C.CString, then the related C function returns errors.
I think the C function based on the string slice(char**) created by the
C.CString all the way.
So, if I do not release the memory created by the C.CString of
Thanks your reply, the point is that I do not know where the C code is
completely done it.
So, I do not release the C.CString currently, but I worry if I have not
released the C.CString, whether the Go code will crash somewhere.
在 2017年8月15日星期二 UTC+8下午12:35:05,Ian Lance Taylor写道:
>
> On Mon, Aug
So, in other words, if I do not release the memory of the C.CString, the Go
program may be crashed caused of the OOM, right?
This is not what I expect, so, I have to release the C.CString on Go side,
and fix this problem(if release the C.CString immediately after invoked the
C function, the C fu
Thanks again, I think the memory would not be too much, it seems that I can
only leave it there, no better ways.
在 2017年8月15日星期二 UTC+8下午5:18:04,Tamás Gulácsi写道:
>
> How much memory would be on hold?
> If you know when it's safe to free the C-used memory, then do it right
> then, but if not and t
As the instruction
of https://github.com/golang/go/wiki/cgo#turning-c-arrays-into-go-slices
shows, the GC of Go will not release it.
An example as the following, but I have a question about when and how to
release this `slice`?
import "C"
import "unsafe"
...
var theCArray *C.YourType =
Thanks your reply, you mean I should be release the memory of `theCArray`
in C side?
I still have some doubts, and I made a clearer example as the below, any
problem with it?
So, the memory of this tmpslice should be release by release the argv on C
side?
func GoStrings(length int, argv **C.ch
Sorry for late reply, thanks very much! I will have a try.
在 2017年8月18日星期五 UTC+8下午4:23:07,Konstantin Khomoutov写道:
>
> On Fri, Aug 18, 2017 at 10:39:29AM +0300, Konstantin Khomoutov wrote:
>
> [...]
> > There can't be easy answer to a question like this in C.
> > Consider:
> >
> > // This fu
I think I encounter the same issue, the logs as the following. As
the https://github.com/golang/go/issues/17384 shows, the issue maybe cased
by calling deference a NULL pointer at PC 0x3fff801b72c0,I should use the
debugger to find the function at this address. But, I could not get the
detaile
16 matches
Mail list logo