FAQ
Hi,

I'm facing the following problem when writing a CGO wrapper for Spread…

I have a C function which does the following (this is not the full source but I think you folks get the point):

#define MAX_GROUPS 32
#define MAX_GROUP_NAME 100

char groupnames[MAX_GROUPS][MAX_GROUP_NAME];
snprintf(groupnames[0], MAX_GROUPS_NAME, "%s", "test";

And then will be passed like this:
some_function((const char (*)[]) groupnames)

I try to get this working using Go.

The following snippet is at least not complaining about the types so I think this is the way to go.

var g[32] _Ctype_char
C.some_function(&g)

But the problem is how do assign the actual values like:

g[0] = "test"

I cannot use C.CString() this will create a *_Ctype_char and I've tried a lot of other things a have seen but no luck yet.

Any advice will be great !

Cheers,

Jeroen

--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 1 | next ›
Discussion Overview
groupgolang-nuts @
categoriesgo
postedJan 29, '13 at 9:25p
activeJan 29, '13 at 9:25p
posts1
users1
websitegolang.org

1 user in discussion

Jeroen Grusewski: 1 post

People

Translate

site design / logo © 2021 Grokbase