Node:scm transition summary, Previous:Mixing gh and scm APIs, Up:GH
The following table summarizes the available information on how to transition from the GH to the scm interface. Where transitioning is not completely straightforward, the table includes a reference to more detailed documentation in the preceding sections.
#include <libguile.h>instead of
guile-configto pick up the flags required to compile C or C++ code that uses
libguile, like so
$(CC) -o prog.o -c prog.c `guile-config compile`
If you are using libtool to link your executables, just use
-lguile in your link command. Libtool will expand this into
the needed linker options automatically. If you are not using
libtool, use the
guile-config program to query the needed
options explicitly. A linker command like
$(CC) -o prog prog.o `guile-config link`
should be all that is needed. To link shared libraries that will be
used as Guile Extensions, use libtool to control both the compilation
and the link stage.
scm_boot_guileinstead, but note that
scm_boot_guilehas a slightly different calling convention from
scm_boot_guile, and the main program function that you specify for
scm_boot_guileto call, both take an additional closure parameter. Guile Initialization Functions for more details.
scm_c_define_gsubrinstead, but note that the arguments are in a different order: for
scm_c_define_gsubrthe C function pointer is the last argument. A Sample Guile Extension for an example.
SCM_ALLOW_INTSinstead. Note that these macros are used without parentheses, as in
scm_str2symbolinstead. [FIXME: inconsistent naming, should be
scm_num2int (obj, SCM_ARG1, str)where str is a C string that describes the context of the call.
scm_num2ulong (obj, SCM_ARG1, str)where str is a C string that describes the context of the call.
scm_num2long (obj, SCM_ARG1, str)where str is a C string that describes the context of the call.
scm_num2dbl (obj, str)where str is a C string that describes the context of the call.
SCM_CHARmacro instead, but note that
SCM_CHARdoes not check that its argument is actually a character. To check that a
SCMvalue is a character before using
SCM_CHARto extract the character value, use the
SCM_BOOLPmacro instead, or replace
SCM_NFALSEP (scm_boolean_p (obj))
SCM_SYMBOLPmacro instead, or replace
SCM_NFALSEP (scm_symbol_p (obj))
SCM_CHARPmacro instead, or replace
SCM_NFALSEP (scm_char_p (obj))
SCM_VECTORPmacro instead, or replace
SCM_NFALSEP (scm_vector_p (obj))
SCM_CONSPmacro instead, or replace
SCM_NFALSEP (scm_pair_p (obj))
SCM_NUMBERPmacro instead, or replace
SCM_NFALSEP (scm_number_p (obj))
SCM_STRINGPmacro instead, or replace
SCM_NFALSEP (scm_string_p (obj))
SCM_NFALSEP (scm_procedure_p (obj))
SCM_NFALSEP (scm_list_p (obj))
SCM_INEXACTPmacro instead, or replace
SCM_NFALSEP (scm_inexact_p (obj))
SCM_NFALSEP (scm_exact_p (obj))
SCM_EQ_Pmacro instead, or replace
gh_eq_p (x, y)by
SCM_NFALSEP (scm_eq_p (x, y))
gh_eqv_p (x, y)by
SCM_NFALSEP (scm_eqv_p (x, y))
gh_equal_p (x, y)by
SCM_NFALSEP (scm_equal_p (x, y))
gh_string_equal_p (x, y)by
SCM_NFALSEP (scm_string_equal_p (x, y))
SCM_NULLPmacro instead, or replace
SCM_NFALSEP (scm_null_p (obj))
d.) Use the corresponding
scm_num2ulong (scm_length (lst), SCM_ARG1, str)where str is a C string that describes the context of the call.
gh_appendN (l1, ..., lN)by
scm_append (scm_listify (l1, ..., lN, SCM_UNDEFINED))
scm_applyinstead, but note that
scm_applytakes an additional third argument that you should set to