From 65b90d7ce93d39c1bc7270a75d99d3c38e3a0cf1 Mon Sep 17 00:00:00 2001 From: Akilan Selvacoumar <31743758+Akilan1999@users.noreply.github.com> Date: Sat, 16 Dec 2023 02:17:25 +0000 Subject: [PATCH] Update Bindings.md --- Docs/Bindings.md | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/Docs/Bindings.md b/Docs/Bindings.md index 879ef82..14c340a 100644 --- a/Docs/Bindings.md +++ b/Docs/Bindings.md @@ -1,16 +1,15 @@ # Language Bindings [Language bindings](https://en.wikipedia.org/wiki/Language_binding) refers to wrappers to bridge 2 programming languages. This is used in P2PRC to extend calling P2PRC functions in other programming languages. Currently this is done by generating ```.so``` and ```.h``` from the Go compiler. -## Current languages supported -- Python - ## How to build shared object files The easier way ```bash +# Run make sharedObjects ``` Or the direct way ```bash +# Run cd Bindings && go build -buildmode=c-shared -o p2prc.so ``` If successfully built: @@ -23,6 +22,32 @@ ls p2prc.h p2prc.so ``` +## Current languages supported +- Python + +### Build sample python program +The easier way +```bash +# Run +make python +# Expected ouput +Output is in the Directory Bindings/python/export/ +# Run +cd Bindings/python/export/ +# list files +ls +# Expected output +SharedObjects/ p2prc.py +``` +Above shows a generated folder which consists of a folder +called "SharedObjects/" which consists of ```p2prc.so``` +and ```p2prc.h``` files. ```p2prc.py``` refers to a +sample python script calling P2PRC go functions. +To start an any project to extend P2PRC with python, +This generated folder can copied and created as a new +git repo for P2PRC extensions scripted or used a reference +point as proof of concept that P2PRC can be called from +other programming languages.