diff --git a/FFI for Python-Node-PHP/README.md b/FFI for Python-Node-PHP/README.md index 24ab2f6..229007b 100644 --- a/FFI for Python-Node-PHP/README.md +++ b/FFI for Python-Node-PHP/README.md @@ -4,4 +4,22 @@ Pyton、node.js、PHP 等可以通过 FFI 方式调用动态库生成 ID。 -这里将提供不同操作系统的动态库 \ No newline at end of file +不同操作系统请引用不同的动态库。 + +## 接口方法说明 + +第1步,**全局** 初始化(应用程序启动时执行一次): +``` +// 设置参数 +// workerId +// workerIdBitLength,影响 workerId最大值,一般设置6。支持的 WorkerId 最大值为2^workerIdBitLength-1 +// seqBitLength,一般只要设置6. +extern "C" void SetOptions(int workerId, int workerIdBitLength, int seqBitLength) +``` + +第2步,生成ID: +``` +// 生成ID +extern "C" long NextId() +``` + diff --git a/FFI for Python-Node-PHP/lib/yitidgen-linux-x64.7z b/FFI for Python-Node-PHP/lib/yitidgen-linux-x64.7z new file mode 100644 index 0000000..4f2a206 Binary files /dev/null and b/FFI for Python-Node-PHP/lib/yitidgen-linux-x64.7z differ diff --git a/FFI for Python-Node-PHP/lib/yitidgen-win-x64.7z b/FFI for Python-Node-PHP/lib/yitidgen-win-x64.7z new file mode 100644 index 0000000..59923cf Binary files /dev/null and b/FFI for Python-Node-PHP/lib/yitidgen-win-x64.7z differ diff --git a/FFI for Python-Node-PHP/lib/yitidgen.dll b/FFI for Python-Node-PHP/lib/yitidgen.dll deleted file mode 100644 index b7f7126..0000000 Binary files a/FFI for Python-Node-PHP/lib/yitidgen.dll and /dev/null differ diff --git a/README.md b/README.md index b28ab6d..1d32380 100644 --- a/README.md +++ b/README.md @@ -205,11 +205,15 @@ redis浣滅敤 馃尣馃彸锔忊嶐煂 C锛歔鏌ョ湅绀轰緥][5] +馃尣馃彸锔忊嶐煂 Vlang锛歔鏌ョ湅绀轰緥][6] + +濡傛灉浣犳湁鍏跺畠璇█鐨勫疄鐜伴渶姹傦紝涓嶅Θ璇曠潃鑷繁鍐欎竴涓紝鎴栬呯粰鎴戠暀瑷銆 + [1]: https://gitee.com/yitter/idgenerator/tree/master/C%23.NET [2]: https://gitee.com/yitter/idgenerator/tree/master/Java [3]: https://gitee.com/yitter/idgenerator/tree/master/Go [4]: https://gitee.com/yitter/idgenerator/tree/master/Rust [5]: https://gitee.com/yitter/idgenerator/tree/master/C - +[6]: https://gitee.com/yitter/idgenerator/tree/master/ZeOthers/Vlang diff --git a/Rust/source/src/lib.rs b/Rust/source/src/lib.rs index 3e63d21..63a664e 100644 --- a/Rust/source/src/lib.rs +++ b/Rust/source/src/lib.rs @@ -106,4 +106,5 @@ pub extern "C" fn NextId() -> i64 { // //return 1; // } -// cargo build --release \ No newline at end of file +// build-win-x64: cargo build --release +// build-linux-x64: cargo build --target x86_64-unknown-linux-musl --release