unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* Passing in data to a function defined with scm_c_define_gsubr
@ 2021-08-13  5:26 Brad Medeiros
  0 siblings, 0 replies; only message in thread
From: Brad Medeiros @ 2021-08-13  5:26 UTC (permalink / raw)
  To: guile-user

Hello everyone!

In short, I'm asking if there is a way to pass some sort of additional
void*  to a function defined with scm_c_define_gsubr (or another equivalent
fn call that has the same behavior) so I can retrieve data that will
resolve a unique id, but more context below.
I am currently using guile in a  game engine as a way to script different
objects.  In doing so, I end up dynamically creating modules, and defining
functions with scm_c_define_gsubr. I need a way to determine a unique id
associated with the gameobject to which the function is associated with.
Currently what I'm doing to resolve this is by calling scm_current_module. This
had been working for me, but I realized my implementation is wrong.

While in practice this has been ok because I had been calling these
functions after I had set the module (in the body of a callback). However,
I realize that this does not generally work, because in practice I
sometimes will call these functions in other contexts when the current
module is not currently bound. I have some links to my actual usage of
source code if this is helpful. Binding for fns:
https://github.com/BradfordMedeiros/ModEngine/blob/master/src/scheme/scheme_bindings.cpp#L737
Conceptual usage of trying to associate the fn call with a scene id:
https://github.com/BradfordMedeiros/ModEngine/blob/master/src/scheme/scheme_bindings.cpp#L87
Currently flawed way I'm resolving the id of that scene:
https://github.com/BradfordMedeiros/ModEngine/blob/master/src/scheme/scriptmanager.cpp#L18


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-08-13  5:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-13  5:26 Passing in data to a function defined with scm_c_define_gsubr Brad Medeiros

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).