-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from FGadvancer/main
feat: add c++/c interface to core
- Loading branch information
Showing
20 changed files
with
3,338 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"files.associations": { | ||
"ostream": "cpp", | ||
"chrono": "cpp", | ||
"thread": "cpp" | ||
}, | ||
"C_Cpp.errorSquiggles": "disabled" | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"tasks": [ | ||
{ | ||
"type": "cppbuild", | ||
"label": "C/C++: g++ build active file", | ||
"command": "/usr/bin/g++", | ||
"args": [ | ||
"-fdiagnostics-color=always", | ||
"-g", | ||
"${file}", | ||
"-o", | ||
"${fileDirname}/${fileBasenameNoExtension}" | ||
], | ||
"options": { | ||
"cwd": "${fileDirname}" | ||
}, | ||
"problemMatcher": [ | ||
"$gcc" | ||
], | ||
"group": { | ||
"kind": "build", | ||
"isDefault": true | ||
}, | ||
"detail": "Task generated by Debugger." | ||
} | ||
], | ||
"version": "2.0.0" | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
go build -buildmode=c-shared -trimpath -ldflags="-s -w" -o openimsdk.dll export.go constant.go protocol.go tools.go | ||
|
||
|
||
|
||
g++ -shared -fPIC -o openimsdkcc.dll openimsdkcc.cc openimsdk.dll |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
gcc -o test.exe -L. openimsdk.dll test.c | ||
test.exe |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/bash | ||
|
||
rm ./openimsdk.so ./openimsdk.h | ||
go build -buildmode=c-shared -trimpath -ldflags="-s -w" -o openimsdk.so export.go constant.go protocol.go tools.go | ||
|
||
|
||
# build cpp sdk | ||
rm ./openimsdkcc.so | ||
g++ -fPIC -shared -o openimsdkcc.so openimsdkcc.cc ./openimsdk.so |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
gcc -o test.exe -L. openimsdk.dll test.c |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
package main | ||
|
||
/* | ||
#include <stdio.h> | ||
*/ | ||
import "C" | ||
|
||
var ( | ||
NO_ERR = C.int(0) | ||
NO_ERR_MSG = C.CString("") | ||
NO_DATA = C.CString("") | ||
NO_PROGRESS = C.int(0) | ||
) | ||
|
||
const ( | ||
CONNECTING = iota | ||
CONNECT_SUCCESS | ||
CONNECT_FAILED | ||
KICKED_OFFLINE | ||
USER_TOKEN_EXPIRED | ||
JOINED_GROUP_ADDED | ||
JOINED_GROUP_DELETED | ||
GROUP_MEMBER_ADDED | ||
GROUP_MEMBER_DELETED | ||
GROUP_APPLICATION_ADDED | ||
GROUP_APPLICATION_DELETED | ||
GROUP_INFO_CHANGED | ||
GROUP_DISMISSED | ||
GROUP_MEMBER_INFO_CHANGED | ||
GROUP_APPLICATION_ACCEPTED | ||
GROUP_APPLICATION_REJECTED | ||
FRIEND_APPLICATION_ADDED | ||
FRIEND_APPLICATION_DELETED | ||
FRIEND_APPLICATION_ACCEPTED | ||
FRIEND_APPLICATION_REJECTED | ||
FRIEND_ADDED | ||
FRIEND_DELETED | ||
FRIEND_INFO_CHANGED | ||
BLACK_ADDED | ||
BLACK_DELETED | ||
SYNC_SERVER_START | ||
SYNC_SERVER_FINISH | ||
SYNC_SERVER_PROGRESS | ||
SYNC_SERVER_FAILED | ||
NEW_CONVERSATION | ||
CONVERSATION_CHANGED | ||
TOTAL_UNREAD_MESSAGE_COUNT_CHANGED | ||
RECV_NEW_MESSAGE | ||
RECV_C2C_READ_RECEIPT | ||
RECV_GROUP_READ_RECEIPT | ||
NEW_RECV_MESSAGE_REVOKED | ||
RECV_MESSAGE_EXTENSIONS_CHANGED | ||
RECV_MESSAGE_EXTENSIONS_DELETED | ||
RECV_MESSAGE_EXTENSIONS_ADDED | ||
RECV_OFFLINE_NEW_MESSAGE | ||
MSG_DELETED | ||
|
||
RECV_NEW_MESSAGES | ||
RECV_OFFLINE_NEW_MESSAGES | ||
|
||
SELF_INFO_UPDATED | ||
USER_STATUS_CHANGED | ||
|
||
RECV_CUSTOM_BUSINESS_MESSAGE | ||
|
||
|
||
MESSAGE_KV_INFO_CHANGED | ||
|
||
UPLOAD_FILE_CALLBACK_OPEN | ||
UPLOAD_FILE_CALLBACK_PART_SIZE | ||
UPLOAD_FILE_CALLBACK_HASH_PART_PROGRESS | ||
UPLOAD_FILE_CALLBACK_HASH_PART_COMPLETE | ||
UPLOAD_FILE_CALLBACK_UPLOAD_ID | ||
UPLOAD_FILE_CALLBACK_UPLOAD_PART_COMPLETE | ||
UPLOAD_FILE_CALLBACK_UPLOAD_COMPLETE | ||
UPLOAD_FILE_CALLBACK_COMPLETE | ||
) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
package event_listener |
Oops, something went wrong.