-
Notifications
You must be signed in to change notification settings - Fork 0
ABI and Memory Ownership
v2rayroot edited this page Jun 14, 2026
·
1 revision
All input and output strings use UTF-8 and are null terminated.
Every non-null char* returned by V2Root Core is owned by the caller and must
be released exactly once with:
void FreeCString(char *value);Passing null to FreeCString is safe.
Never use free, HeapFree, LocalFree, CoTaskMemFree, or a language runtime
allocator on returned pointers.
| Result | Meaning |
|---|---|
Null from Start or Stop
|
Success |
Non-null from Start or Stop
|
Allocated error message |
| Allocated empty string from parser APIs | Parse/conversion failure |
An empty parser result still needs FreeCString.
char *status = GetStatus();
if (status != NULL) {
printf("%s\n", status);
FreeCString(status);
}- Copy the native string before releasing it.
- Do not expose raw pointers outside the wrapper.
- Do not unload the library while returned pointers are alive.
- Use the generated header as the ABI source of truth.
void FreeCString(char *value);This is the only supported release function for native strings.