copy_string() is a macro in the OCaml C API, so rename the function
to copy_str(). Add a runtime test.
The minherit runtime test was fixed by b64d685.
Use the proper syntax for accessing member variables in
unions_runme.ml
13 lines
240 B
OpenEdge ABL
13 lines
240 B
OpenEdge ABL
%module string_simple
|
|
|
|
%newobject copy_str;
|
|
|
|
%inline %{
|
|
#include <string.h>
|
|
const char* copy_str(const char* str) {
|
|
size_t len = strlen(str);
|
|
char* newstring = (char*) malloc(len + 1);
|
|
strcpy(newstring, str);
|
|
return newstring;
|
|
}
|
|
%}
|