[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Passing in data to a function defined with scm_c_define_gsubr

From: Brad Medeiros
Subject: Passing in data to a function defined with scm_c_define_gsubr
Date: Thu, 12 Aug 2021 22:26:47 -0700

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:
Conceptual usage of trying to associate the fn call with a scene id:
Currently flawed way I'm resolving the id of that scene:

reply via email to

[Prev in Thread] Current Thread [Next in Thread]