Generic (void *)int
Maurizio Cimadamore
maurizio.cimadamore at oracle.com
Mon Feb 18 13:13:29 UTC 2019
On 18/02/2019 11:45, Mark Raynsford wrote:
> Most OpenGL bindings such as JOGL and
> LWJGL actually expose both pointer-typed and a long-typed overloads of
> glVertexAttribPointer and friends for this reason. Maybe something more
> along those lines would be satisfactory for these edge cases?
I think you hit the nail on the head - this is, ultimately, what we call
a 'civilization' layer problem.
Every API will have some domain-specific knowlegde of the pointers being
passed around - in some cases these could be strings (which we'd like to
pass around as plain Java strings), in other case (such as this) just
numbers, offsets - in which case what you really want is the client to
be able to pass just a number (not a pointer).
Currently the only way to civilize in this manner is to write a new
header which includes the main header, and add the extra civilized API
points - whose implementation will just call the main, pointer-based, ones.
This will work well in this case, but of course requires generating a
shared library wrapper - which increases the maintenance cost - so it is
a tradeoff.
Longer term, some kind of jextract plugin/API will significantly
simplify such tasks.
Maurizio
More information about the panama-dev
mailing list