feat: add bat of gen android's so.
Signed-off-by: Gordon <46924906+FGadvancer@users.noreply.github.com>
This commit is contained in:
parent
e65f192388
commit
e442c41866
@ -1 +1,2 @@
|
|||||||
go build -buildmode=c-shared -ldflags="-s -w" -o openim.dll export.go
|
go build -buildmode=c-shared -trimpath -ldflags="-s -w" -o openIM.dll export.go
|
||||||
|
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
gcc -o test.exe -L. openim.dll test.c
|
gcc -o test.exe -L. openIM.dll test.c
|
||||||
test.exe
|
test.exe
|
@ -1 +1 @@
|
|||||||
gcc -o test.exe -L. openim.dll test.c
|
gcc -o test.exe -L. openIM.dll test.c
|
32
c_wrapper/gen_android_so.bat
Normal file
32
c_wrapper/gen_android_so.bat
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
set NDK_PATH=D:\android_sdk\ndk-bundle
|
||||||
|
set SO_NAME=openIM
|
||||||
|
set OUT_PATH=android\
|
||||||
|
|
||||||
|
set CGO_ENABLED=1
|
||||||
|
|
||||||
|
REM 生成 armeabi-v7a
|
||||||
|
set GOOS=android
|
||||||
|
set GOARCH=arm
|
||||||
|
set CC=%NDK_PATH%\toolchains\llvm\prebuilt\windows-x86_64\bin\armv7a-linux-androideabi16-clang.cmd
|
||||||
|
|
||||||
|
go build -buildmode=c-shared -trimpath -ldflags="-s -w" -o %OUT_PATH%armeabi-v7a\%SO_NAME%.so export.go
|
||||||
|
|
||||||
|
REM 生成 arm64-v8a
|
||||||
|
set GOARCH=arm64
|
||||||
|
set CC=%NDK_PATH%\toolchains\llvm\prebuilt\windows-x86_64\bin\aarch64-linux-android21-clang.cmd
|
||||||
|
|
||||||
|
go build -buildmode=c-shared -trimpath -ldflags="-s -w" -o %OUT_PATH%arm64-v8a\%SO_NAME%.so export.go
|
||||||
|
|
||||||
|
REM 生成 x86
|
||||||
|
set GOARCH=386
|
||||||
|
set CC=%NDK_PATH%\toolchains\llvm\prebuilt\windows-x86_64\bin\i686-linux-android16-clang.cmd
|
||||||
|
|
||||||
|
go build -buildmode=c-shared -trimpath -ldflags="-s -w" -o %OUT_PATH%x86\%SO_NAME%.so export.go
|
||||||
|
|
||||||
|
REM 生成 x86_64
|
||||||
|
set GOARCH=amd64
|
||||||
|
set CC=%NDK_PATH%\toolchains\llvm\prebuilt\windows-x86_64\bin\x86_64-linux-android21-clang.cmd
|
||||||
|
|
||||||
|
go build -buildmode=c-shared -trimpath -ldflags="-s -w" -o %OUT_PATH%x86_64\%SO_NAME%.so export.go
|
||||||
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "c_wrapper.h"
|
#include "openIM.h"
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
@ -33,7 +33,7 @@ void on_user_token_expired()
|
|||||||
{
|
{
|
||||||
printf("on_user_token_expired\n");
|
printf("on_user_token_expired\n");
|
||||||
}
|
}
|
||||||
void on_connect_failed(int err_code, void *err_msg)
|
void on_connect_failed(int err_code, char *err_msg)
|
||||||
{
|
{
|
||||||
char *message = (char *)err_msg;
|
char *message = (char *)err_msg;
|
||||||
printf("Error code: %d\n", err_code);
|
printf("Error code: %d\n", err_code);
|
||||||
@ -43,7 +43,7 @@ void success(char *data)
|
|||||||
{
|
{
|
||||||
printf("login success : %s\n", data);
|
printf("login success : %s\n", data);
|
||||||
}
|
}
|
||||||
void main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
char operationID[] = "12345";
|
char operationID[] = "12345";
|
||||||
char uid[] = "6959062403";
|
char uid[] = "6959062403";
|
||||||
@ -58,4 +58,5 @@ void main(int argc, char **argv)
|
|||||||
login(success, on_connect_failed, operationID, uid, token);
|
login(success, on_connect_failed, operationID, uid, token);
|
||||||
|
|
||||||
sleep(1000000);
|
sleep(1000000);
|
||||||
|
return 0;
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user