From ea08b5c3eafa1215d8584f22f2da92ab341e4f76 Mon Sep 17 00:00:00 2001 From: Akilan Selvacoumar <31743758+Akilan1999@users.noreply.github.com> Date: Sat, 16 Dec 2023 02:57:44 +0000 Subject: [PATCH] Update Bindings.md --- Docs/Bindings.md | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/Docs/Bindings.md b/Docs/Bindings.md index 0fb6867..7d12d5a 100644 --- a/Docs/Bindings.md +++ b/Docs/Bindings.md @@ -4,17 +4,17 @@
## How to build shared object files -The easier way +#### The easier way ```bash # Run make sharedObjects ``` -Or the direct way +#### Or the direct way ```bash # Run cd Bindings && go build -buildmode=c-shared -o p2prc.so ``` -If successfully built: +#### If successfully built: ```bash # Enter into the Bindings directory cd Bindings @@ -40,12 +40,11 @@ Client.go There a few things to notice which are different from your standard Go programs: -1. We import "C" which means [Cgo](https://pkg.go.dev/cmd/cgo) is required. +#### 1. We import "C" which means [Cgo](https://pkg.go.dev/cmd/cgo) is required. ```go import "C" ``` -2. All functions which are required to be called from other programming languages -have comment such as. +#### 2. All functions which are required to be called from other programming languages have comment such as. ```go //export @@ -65,8 +64,7 @@ func StartContainer(IP string) (output *C.char) { return ConvertStructToJSONString(container) } ``` -3. While looking through the file (If 2 files are compared -it is pretty trivial to notice a common structure). +#### 3. While looking through the file (If 2 files are compared it is pretty trivial to notice a common structure). ```go // --------- Example ------------ @@ -89,7 +87,7 @@ func ViewPlugin() (output *C.char) { } ``` -It is easy to notice that: +#### It is easy to notice that: - ```ConvertStructToJSONString()```: This is a helper function that convert a go object to JSON string initially and converts it to ```CString```. - ```(output *C.char)```: This is the return type for most of the functions.