679 |
@node Compiled Code Modules |
@node Compiled Code Modules |
680 |
@subsection Putting Compiled Code into Modules |
@subsection Putting Compiled Code into Modules |
681 |
|
|
682 |
@c FIXME::martin: Change all gh_ references to their scm_ equivalents. |
The new primitives that you add to Guile with |
683 |
|
@code{scm_c_define_gsubr} (@pxref{Primitive Procedures}) or with any |
684 |
The new primitives that you add to Guile with @code{gh_new_procedure} |
of the other mechanisms are placed into the @code{(guile-user)} module |
685 |
or with any of the other mechanisms are normally placed into the same |
by default. However, it is also possible to put new primitives into |
686 |
module as all the other builtin procedures (like @code{display}). |
other modules. |
|
However, it is also possible to put new primitives into their own |
|
|
module. |
|
687 |
|
|
688 |
The mechanism for doing so is not very well thought out and is likely to |
The mechanism for doing so is not very well thought out and is likely to |
689 |
change when the module system of Guile itself is revised, but it is |
change when the module system of Guile itself is revised, but it is |
690 |
simple and useful enough to document it as it stands. |
simple and useful enough to document it as it stands. |
691 |
|
|
692 |
What @code{gh_new_procedure} and the functions used by the snarfer |
What @code{scm_c_define_gsubr} and the functions used by the snarfer |
693 |
really do is to add the new primitives to whatever module is the |
really do is to add the new primitives to whatever module is the |
694 |
@emph{current module} when they are called. This is analogous to the |
@emph{current module} when they are called. This is analogous to the |
695 |
way Scheme code is put into modules: the @code{define-module} expression |
way Scheme code is put into modules: the @code{define-module} expression |
699 |
this current module. |
this current module. |
700 |
|
|
701 |
Therefore, all we need to do is to make sure that the right module is |
Therefore, all we need to do is to make sure that the right module is |
702 |
current when calling @code{gh_new_procedure} for our new primitives. |
current when calling @code{scm_c_define_gsubr} for our new primitives. |
703 |
|
|
704 |
@node Dynamic Linking and Compiled Code Modules |
@node Dynamic Linking and Compiled Code Modules |
705 |
@subsection Dynamic Linking and Compiled Code Modules |
@subsection Dynamic Linking and Compiled Code Modules |