some wrap to cpp
This commit is contained in:
@@ -1,5 +1,9 @@
|
|||||||
#include <ffi.h>
|
#include <ffi.h>
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
|
||||||
void *llog_ffi_closure_alloc(void **code) {
|
void *llog_ffi_closure_alloc(void **code) {
|
||||||
return ffi_closure_alloc(sizeof(ffi_closure), code);
|
return ffi_closure_alloc(sizeof(ffi_closure), code);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -10,7 +10,7 @@ import (
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
LLGoPackage = "link: $(pkg-config --libs libffi); -lffi"
|
LLGoPackage = "link: $(pkg-config --libs libffi); -lffi"
|
||||||
LLGoFiles = "$(pkg-config --cflags libffi): _wrap/libffi.c"
|
LLGoFiles = "$(pkg-config --cflags libffi): _wrap/libffi.cpp"
|
||||||
)
|
)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
#include <uv.h>
|
#include <uv.h>
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
|
||||||
int uv_tcp_get_io_watcher_fd (uv_tcp_t* handle) {
|
int uv_tcp_get_io_watcher_fd (uv_tcp_t* handle) {
|
||||||
return handle->io_watcher.fd;
|
return handle->io_watcher.fd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
LLGoPackage = "link: $(pkg-config --libs libuv); -luv"
|
LLGoPackage = "link: $(pkg-config --libs libuv); -luv"
|
||||||
LLGoFiles = "$(pkg-config --cflags libuv): _wrap/libuv.c"
|
LLGoFiles = "$(pkg-config --cflags libuv): _wrap/libuv.cpp"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ----------------------------------------------
|
// ----------------------------------------------
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
#include <openssl/crypto.h>
|
#include <openssl/crypto.h>
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
|
||||||
void opensslFree(void *ptr) {
|
void opensslFree(void *ptr) {
|
||||||
OPENSSL_free(ptr);
|
OPENSSL_free(ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -25,7 +25,7 @@ import (
|
|||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
const (
|
const (
|
||||||
LLGoFiles = "$(pkg-config --cflags openssl): _wrap/openssl.c"
|
LLGoFiles = "$(pkg-config --cflags openssl): _wrap/openssl.cpp"
|
||||||
LLGoPackage = "link: $(pkg-config --libs openssl); -lssl -lcrypto"
|
LLGoPackage = "link: $(pkg-config --libs openssl); -lssl -lcrypto"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
|
||||||
|
extern "C" {
|
||||||
|
|
||||||
#if defined(__GNUC__) || defined(__clang__)
|
#if defined(__GNUC__) || defined(__clang__)
|
||||||
void llgo_getcpuid(unsigned int eax, unsigned int ecx,
|
void llgo_getcpuid(unsigned int eax, unsigned int ecx,
|
||||||
unsigned int *a, unsigned int *b,
|
unsigned int *a, unsigned int *b,
|
||||||
@@ -19,3 +22,5 @@ void llgo_getcpuid(unsigned int eax, unsigned int ecx,
|
|||||||
#else
|
#else
|
||||||
#error This code requires GCC or Clang
|
#error This code requires GCC or Clang
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
}
|
||||||
@@ -10,7 +10,7 @@ import (
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
LLGoPackage = "link"
|
LLGoPackage = "link"
|
||||||
LLGoFiles = "_wrap/cpu_x86.c"
|
LLGoFiles = "_wrap/cpu_x86.cpp"
|
||||||
)
|
)
|
||||||
|
|
||||||
//go:linkname c_getcpuid C.llgo_getcpuid
|
//go:linkname c_getcpuid C.llgo_getcpuid
|
||||||
|
|||||||
Reference in New Issue
Block a user