This is the mail archive of the guile@cygnus.com mailing list for the guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: implementing data tags via object properties -- help with debugging?


robertb@continuumsi.com writes:

 >  > one immediately apparent problem is using `gh_eval_str'.  you
 >  > probably want to simply save the return value of
 >  > `gh_new_procedure', an SCM.
 > 
 > Well, doing that defeats the purpose of trying not to have global
 > variables!  Perhaps I was too idealist to believe that I could avoid
 > use of global variables in Guile.  It was so easy in X-Windows!

in your example, does this code

   gh_set_ext_data(gh_new_procedure1_0("ReadSymbols", ServerReadSymbols),
                   (void*)lib);

get called multiply?  each `gh_new_procedure1_0' call returns a new
procedure object.

`ServerReadSymbols' is already global in the C function namespace and
"ReadSymbols" is already global in the string pool.  you are starting
with global data and then calling a function that gives you a new
pointer each time called.  probably you will want to emulate libguile
practice of making `ServerReadSymbols' file static and then in the init
procedure (called only once), saving the SCM.  then you can pass this
SCM around w/ resorting to `gh_eval_str' (which consults yet another
global namespace...).

thi

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]