The following code didn't produce an exception. I need to do some additional work to make sure it isn't a bug in my test cases - the test case creates the stream term using with_output_to(string(String), ...), so the problem could be there. [Opening an "issue" because I don't want to forget this - please assign it to me if the problem isn't obvious]
static foreign_t
w_atom_ffi_(term_t stream, term_t t)
{ IOSTREAM* s;
atom_t a;
if ( !PL_get_stream(stream, &s, SIO_INPUT || /* should be SIO_OUTPUT */
!PL_get_atom_ex(t, &a) )
return FALSE;
PL_STRINGS_MARK();
size_t len;
const pl_wchar_t *sa = PL_atom_wchars(a, &len);
SfprintfX(s, "/%Ws/%zd", sa, len); /* should fail */
PL_STRINGS_RELEASE();
return TRUE;
}
For the test, this is wrapped with:
w_atom_ffi(Atom, String) :-
with_output_to(string(String), w_atom_ffi_(current_output, Atom)).
The following code didn't produce an exception. I need to do some additional work to make sure it isn't a bug in my test cases - the test case creates the stream term using
with_output_to(string(String), ...), so the problem could be there. [Opening an "issue" because I don't want to forget this - please assign it to me if the problem isn't obvious]For the test, this is wrapped with: