Created
February 25, 2022 12:21
-
-
Save kostix/4ef0cfddc4f06a06f3c9c3fa73cb278a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
/* | |
#include <stdio.h> | |
struct real_client { | |
int x; | |
}; | |
typedef struct Client{ | |
struct real_client c; | |
} Client; | |
int doSomething(struct real_client *c) { | |
printf("%d\n", c->x); | |
} | |
*/ | |
import "C" | |
type Client struct { | |
client C.Client | |
} | |
func main() { | |
cl := Client{} | |
cl.client.c.x = 42 | |
C.doSomething(&cl.client.c) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module whatever | |
go 1.15 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cgoptr$ ~/devel/golang-1.16.13/bin/go build | |
cgoptr$ GODEBUG=cgocheck=2 ./whatever | |
42 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment