parent
7404a54683
commit
5dace36823
@ -0,0 +1,6 @@ |
|||||||
|
{ |
||||||
|
"files.associations": { |
||||||
|
"stdio.h": "c", |
||||||
|
"c_wrapper.h": "c" |
||||||
|
} |
||||||
|
} |
@ -0,0 +1 @@ |
|||||||
|
go build -buildmode=c-shared -o c_wrapper.dll export.go |
@ -0,0 +1,2 @@ |
|||||||
|
gcc -o test.exe -L. c_wrapper.dll test.c |
||||||
|
test.exe |
@ -0,0 +1 @@ |
|||||||
|
gcc -o test.exe -L. c_wrapper.dll test.c |
Binary file not shown.
@ -0,0 +1,13 @@ |
|||||||
|
package main |
||||||
|
|
||||||
|
import "C" |
||||||
|
import "fmt" |
||||||
|
|
||||||
|
//export Init_SDK
|
||||||
|
func Init_SDK() { |
||||||
|
fmt.Println("Init SDK") |
||||||
|
} |
||||||
|
|
||||||
|
func main() { |
||||||
|
|
||||||
|
} |
@ -0,0 +1,10 @@ |
|||||||
|
// gcc -o test.exe -lc_wrapper.dll test.c
|
||||||
|
|
||||||
|
#include <stdio.h> |
||||||
|
|
||||||
|
#include "c_wrapper.h" |
||||||
|
|
||||||
|
void main(int argc, char **argv) |
||||||
|
{ |
||||||
|
Init_SDK(); |
||||||
|
} |
@ -1,35 +0,0 @@ |
|||||||
package main |
|
||||||
|
|
||||||
/* |
|
||||||
#include <stdio.h> |
|
||||||
typedef void (*base_func)(); |
|
||||||
typedef void (*err_func)(int,void *); |
|
||||||
|
|
||||||
base_func _onConnecting; |
|
||||||
base_func _onConnectSuccess; |
|
||||||
base_func _onKickedOffline; |
|
||||||
base_func _onUserTokenExpired; |
|
||||||
err_func _onConnectFailed; |
|
||||||
|
|
||||||
void c_onConnecting() |
|
||||||
{ |
|
||||||
_onConnecting(); |
|
||||||
} |
|
||||||
void c_onConnectSuccess() |
|
||||||
{ |
|
||||||
_onConnectSuccess(); |
|
||||||
} |
|
||||||
void c_onKickedOffline() |
|
||||||
{ |
|
||||||
_onKickedOffline(); |
|
||||||
} |
|
||||||
void c_onUserTokenExpired() |
|
||||||
{ |
|
||||||
_onUserTokenExpired(); |
|
||||||
} |
|
||||||
void c_onConnectFailed(int errCode,void* errMsg) |
|
||||||
{ |
|
||||||
_onConnectFailed(errCode,errMsg); |
|
||||||
} |
|
||||||
*/ |
|
||||||
import "C" |
|
Loading…
Reference in new issue