Closed electronstudio closed 2 years ago
I wasn't aware python could utilise static libraries.
Generally libs are built as dynamic for the system, but static for a project. With Nix, each package is isolated into it's own directory. There's some symlink magic, but often libs need patching. The bundled libs don't have access to xlib and others out of the box, hence I use my system installed versions. I don't have a static one built however.
What's the advantage you get with static over dynamic?
I don't know if it's inherent to their nature or just a quirk of how CFFI works, but I found:
Also I think I recall it was not possible to do the reflection required for the helper functions in https://github.com/electronstudio/raylib-python-cffi/blob/master/raylib/pyray.py with the dynamic version.
I think you're right when you said theres 2 different projects here.
Having to do from raylib.dynamic import ...
and ditto for static is a bit strange. I'd expect import raylib as rl
to 'just work'.
Alternatively you could chain import raylib
to attempt to import static and failing that import dynamic to avoid the extra layer of imports.
I'm sure the issues of reflection with the dynamic library can probably be solved but it might be a bit more involved. I found Cython worked quite well when I was binding GLFW.
Agreed, I probably will make the static import the default one and split the dynamic version out into a separate project.
However I'm not currently using the Raylib binding for any projects of my own, and until you started using it I wasn't aware of anyone else using it either. So improving the dynamic version with reflection or re-writing the whole binding in Cython are probably things I won't get around to doing myself unless I find a reason to use Raylib myself again.
Understood, I don't expect you to go out of your way to make these changes. For the time being I'm able to use raylib-py with some changes I made to it, so I'm not fussed.
Dynamic library has been split into a separate module. They have (almost) identical APIs so you can use either with no code changes. https://electronstudio.github.io/raylib-python-cffi/dynamic.html
I didn't think anyone was using the dynamic libs, but apparently @adamlwgriffiths is, so I have created a wheel that includes them.
To create the wheel:
This produces
dist/raylib_dynamic-3.7.0.post1-py3-none-any.whl
which includes onlyraylib.dynamic
but should work on win/mac/linux any version of python with no compilation required.I have attached the wheel here: raylib_dyamic_wheel.zip
Should we put this on pypi?