[clisp-list] ffi:c-string as out parameter

Hi,
I would like to use c-string as out parameter.
According to the documentation, it should use :alloca
the function is:
void test(char** buff){
char *output = "asdfasdflsadkjfdsa;l";
char* szRes = (char*)malloc(100000);
strcpy(szRes,output);
szRes[strlen(output)]=0;
*buff = szRes;
}
ffi code is:
(def-call-out test (:name "test")
(:arguments (buff (c-ptr c-string) :out :alloca))
(:return-type nil))
and the question is:
Should I take care of freeing of the memory or clisp will free it?
Regards, AngelP

Thread view

Hi,
I would like to use c-string as out parameter.
According to the documentation, it should use :alloca
the function is:
void test(char** buff){
char *output = "asdfasdflsadkjfdsa;l";
char* szRes = (char*)malloc(100000);
strcpy(szRes,output);
szRes[strlen(output)]=0;
*buff = szRes;
}
ffi code is:
(def-call-out test (:name "test")
(:arguments (buff (c-ptr c-string) :out :alloca))
(:return-type nil))
and the question is:
Should I take care of freeing of the memory or clisp will free it?
Regards, AngelP