Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GFFI needs user-module injectable structs #100

Open
GoogleCodeExporter opened this issue Aug 23, 2015 · 0 comments
Open

GFFI needs user-module injectable structs #100

GoogleCodeExporter opened this issue Aug 23, 2015 · 0 comments

Comments

@GoogleCodeExporter
Copy link

We currently only support structs in GFFI which are defined at GPSEE compile 
time.  This is fine our POSIX-compatibility goal, but is a poor UX for users 
wanting to use structs for third-party libraries.

The existing code works by identifying the following characteristics of each 
struct at compile-time:
 - Name of struct
 - Name of each struct field
 - Datatype of each struct field
 - Size of each struct field
 - Offset of each struct field

Once this information is known, GFFI can automatically reflect the entire 
struct into a JS object.

I would like a nice API to update this internal data structure, so that native 
modules built *outside of* of GPSEE (e.g. code in surelynx/gpsee-modules) can 
declare new structs, efficiently.

Since we can still use the C compiler to help us figure out offsetOf(), etc, we 
can still guarantee perfect compatibility across platforms, unlike solutions 
which rely on JS-runtime struct injection.

It should be possible to basically re-use the struct declaration macros, etc, 
in GFFI in another module and have everything "just work" to add new GFFI 
functionality after a given module is loaded.  Hopefully we can avoid 
macro-copying, I would like to just #include them, probably via information in 
outside.mk.

Original issue reported on code.google.com by wes@page.ca on 5 Sep 2012 at 3:37

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant