I uploaded the code to a github repository and added a
Makefile using pkg-config (you are right about the .zip, it looks
weird):
https://github.com/eduardoacye/GuileCppApplication
>Can you explain why you want to `send' scm_boot_guile'? I can't figure
>it out from your description and your code.
English
is not my native language and my translation from my spanish
programming jargon doesn't make my question clear. I'll try to explain
myself better:
The scm_boot_guile receives the following arguments: (int argc , char ** argv , void (* main_func )(void * data , int argc , char ** argv ), void * data ).
My program calls
scm_boot_guile from the member function
init() of the
GuileApplication class. There is no problem passing the
argc and
argv to
scm_boot_guile, however i want to pass the member function
guileMain as the third argument of
scm_boot_guile
like a void function pointer (i can't cast the member function as a
function pointer). The current way i'm avoiding this problem is passing
as the third argument a function outside of the
GuileApplication class, and passing the address of the instance of the
GuileApplication as the fourth argument for dereferencing the object and calling the
guileMain member function from there, so i had to make this non-member function a friend of
GuileApplication.
This method works but it doesn't seem to be a clean way of doing
things. I'm not proficient in C++ or Guile and there might be a better
way of initializing Guile from C++.
>I'm not sure what you mean. If you don't want to exit while exceptions
>occur, you can just catch them all with #t and print the error message,
>then call your main loop again.
>My solution is not a good one, just one of the possible way, maybe not
>suit for your code. I suggest you elaborate your problem.
It's my first time programming using guile exceptions, so i don't know if i'm doing things correctly.
When i'm evaluating an scheme _expression_ from C++ i call:
result = scm_internal_catch(SCM_BOOL_T, guileEvalBody, (void *)buffer, guileEvalHandler, NULL);
where result is an SCM, guileEvalBody is a function that just calls scm_c_eval_string, buffer is a char *. The guileEvalHandler function is just a cheap copy of the scm_handle_by_message_noexit function (from the guile sourcecode in /libguile/throw.c) but it doesn't return #f.
I want to be able to print the error message, but the handler_message function is only aviable from the throw.c
file (because it is static) so i had to copy the code in my file. Is
there a way to print the error messages without having to do this?
By the way, I thought that it is curious that this functions are not documented in the reference manual.
I'll try to improve my code with this recomendation, thanks :)