You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+33-44Lines changed: 33 additions & 44 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -179,61 +179,50 @@ cJSON_bool Bool
179
179
180
180
### Customizing Bindings
181
181
#### Function Customization
182
-
When you run llcppg directly with the above configuration, it will generate function names according to the configuration. After execution, you'll find a `llcppg.symb.json` file in the current directory.
182
+
After execution, you can directly see the mapped functions in the result.
-`mangle` field contains the symbol name of function
205
-
-`c++` field shows the function prototype from the header file
206
-
-`go` field displays the function name that will be generated in LLGo binding.
199
+
{
200
+
"symMap":{
201
+
"mangle":"<goFuncName> | <.goMethodName> | -"
202
+
}
203
+
}
204
+
```
205
+
`mangle` is the symbol name of the function. For the value of `mangle`, you can customize it as:
206
+
1.`goFuncName` - generates a regular function named `goFuncName`
207
+
2.`.goMethodName` - generates a method named `goMethodName` (if it doesn't meet the rules for generating a method, it will be generated as a regular function)
208
+
3.`-` - completely ignore this function
207
209
208
-
You can customize this field to:
209
-
1. Change function names (e.g. "CreateObject" to "Object" for simplicity)
210
-
2. Remove the method receiver prefix to generate a function instead of a method
211
-
3. Set it to "-" to completely ignore this function
212
-
213
-
For example, to convert `(*CJSON).PrintUnformatted` from a method to a function, simply remove the `(*CJSON).` prefix in the configuration file:
210
+
For example, to convert `(*CJSON).PrintUnformatted` from a method to a function, you can use follow config:
214
211
215
212
```json
216
-
[
217
-
{
218
-
"mangle": "cJSON_PrintUnformatted",
219
-
"c++": "cJSON_PrintUnformatted(const cJSON *)",
220
-
"go": "PrintUnformatted"
221
-
},
222
-
]
213
+
{
214
+
"symMap":{
215
+
"cJSON_PrintUnformatted":"PrintUnformatted"
216
+
}
217
+
}
223
218
```
224
219
This will generate a function instead of a method in the Go code:
0 commit comments