How to import and use C func(context_p ctx, char ** output)?
Posted: Thu Jan 11, 2007 9:00 am
How can I import and use:
int template_parse_string(context_p ctx, char *template_filename, char **output);
??? I know how to import and use C functions, but this one in particular is giving me problems with the char ** output parameter. This is a pointer to a string pointer. It's not an array of string pointers. Here's an example usage:
(set 't (context_init))
(context_set_value t "name" "John Doe")
(template_parse_string t "Hello, {{= name}}" output-value)
(println output-value) ;; Hello, John Doe
I've tried:
(set 'output-value "")
(template_parse_string t "..." (address output-value))
but when I run my newlisp code, all I get is a Bus error.
Any ideas?
Jeremy
int template_parse_string(context_p ctx, char *template_filename, char **output);
??? I know how to import and use C functions, but this one in particular is giving me problems with the char ** output parameter. This is a pointer to a string pointer. It's not an array of string pointers. Here's an example usage:
(set 't (context_init))
(context_set_value t "name" "John Doe")
(template_parse_string t "Hello, {{= name}}" output-value)
(println output-value) ;; Hello, John Doe
I've tried:
(set 'output-value "")
(template_parse_string t "..." (address output-value))
but when I run my newlisp code, all I get is a Bus error.
Any ideas?
Jeremy