I return strings from dlls like this:
Now for the same of memory management, I believe it should be like this:
However, this causes a crash in my program. Do I need to manually free the byte ptr like this?
global ReturnString:Byte ptr Function GetString:Byte Ptr() GCEnter() ReturnString="Hello".tocstring() return ReturnString EndFunction
Now for the same of memory management, I believe it should be like this:
global ReturnString:Byte ptr Function GetString:Byte Ptr() GCEnter() If ReturnString<>Null MemFree ReturnString ReturnString="Hello".tocstring() return ReturnString EndFunction
However, this causes a crash in my program. Do I need to manually free the byte ptr like this?