[plt-scheme] Simple question about MzScheme embbeded

From: Daniel CAUNE (d.caune at wanadoo.fr)
Date: Thu Oct 31 16:10:17 EST 2002


I'm trying to embed MzScheme into a C/C++ application. I've began to read
the documentation "Inside PLT MzScheme" Matthew Flatt has written. The code
example works perfectly. However, I would like to convert the result of a
symbolic expression evaluation, the function scheme_eval_string returns, to
a string.

I took a look to the documentation's index, and I found the function
scheme_get_string. Because I'm so hurried to get my example working, I take
my chance with this function, even, it would be better to read the complete
Matthew's documentation before...

Scheme_Object * result = scheme_eval_string(sexp,  m_schemeEnvironment);
char * buffer = new char[256];
scheme_get_string(NULL, result, buffer, 0, 256, 0, 0, NULL);

Oups.... my computer complains an access violation! Seems that this function
doesn't work like I supposed it does. Could you please give me some clues?
Which is the function that fits my need? Do I have to test the type of the
Scheme object, and to call the corresponding function to retrieve the value
(such as scheme_get_int_val for an integer value)?



Posted on the users mailing list.