[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Calling function (command-line) from c++ dll
From: |
Marius Vollmer |
Subject: |
Re: Calling function (command-line) from c++ dll |
Date: |
Mon, 17 Nov 2003 16:00:54 +0100 |
User-agent: |
Gnus/5.1002 (Gnus v5.10.2) Emacs/21.3 (gnu/linux) |
Laurent Marzullo <address@hidden> writes:
> I'm currently writting a module that I load with (load-extension)
> function and I'm tryin to get the command line option of the guile
> script into the init function of the dll.
As Stephen has pointed out, just use the C function
scm_program_arguments for this.
But in case you are wondering how to call Scheme functions in general:
SCM
call_named_function_with_no_args (const char *name)
{
return scm_call_0 (scm_variable_ref (scm_c_lookup (name)));
}
SCM
call_named_function_with_one_arg (const char *name, SCM arg1)
{
return scm_call_1 (scm_variable_ref (scm_c_lookup (name)), arg1);
}
But if you want to call a function more than once, you should of
course store away the result of scm_variable_ref and use it directly
with scm_call_<n>.
The function scm_c_call_with_current_module is used to temporarily
switch to a different module and execute code there. It is not
related to calling Scheme functions.
(scm_call_<n> is unfortunately not yet in the 1.6.x manual...)
--
GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3 331E FAF8 226A D5D4 E405