nalaginrut <[email protected]> writes:
> I found SCM_BOOL_T will convert to #nil in the Guile.
You must be including the C headers from Guile 1.8, but linking to
libguile from Guile 2.0.
Mark
> If we write c-function like this:
> ============================
> SCM_DEFINE(scm_my_init, "my-init", 1, 0, 0,
> (SCM flags),
> "Initializes my env.")
> #define FUNC_NAME s_scm_my_init
> {
> SCM_ASSERT(scm_is_integer(flags), flags, SCM_ARG1, FUNC_NAME);
>
> if( init_somthing(scm_to_ulong(flags)) == -1 )
> return SCM_BOOL_F;
> else
> return SCM_BOOL_T;
>
> }
> #undef FUNC_NAME
>
> =============================
> If init_something success, return true, else false.
>
> And I call this "my-init" function in the Guile:
> ---------------------------
> (if (not (my-init flags))
> (error "init failed!")
> (format #f "init ok!~%")
> )
> ---------------------------
>
> The problem is SCM_BOOL_T convert to #nil, and (not #nil)==>#t ! So I
> can't get a logical result.
>
> Is this conversion accepted? Or I made some mistakes?
> Any help would be appreciated! Thanks!