Open greenfork opened 3 years ago
Phew... It was close !
Fixed ptr
issue on main.
RAYGUIDEF
issue was gone as well.
Double pragma generation was fixed.
Great, thanks!
Also an update on raygui. I found a way to link it statically on "as needed" basis which means that we don't need to compile it as a shared library, just need the copy of source file when compiling the executable. Here is implementation: https://github.com/greenfork/nimraylib_now/blob/master/src/nimraylib_now/raygui.nim#L5. One downside though is that we can't use dynlib
with it anymore because of name mangling
Fixed those pesky function name aliasing. Oh well.
Great, thanks!
Also an update on raygui. I found a way to link it statically on "as needed" basis which means that we don't need to compile it as a shared library, just need the copy of source file when compiling the executable. Here is implementation: https://github.com/greenfork/nimraylib_now/blob/master/src/nimraylib_now/raygui.nim#L5. One downside though is that we can't use
dynlib
with it anymore because of name mangling
Oh, btw: can you do me a favor and compile raygui.h
to .DLL that refers to libraylib.dll
instead of just raylib.dll
?
It's just as far from convinient as it is right now, since all OS except Windows uses lib*
notation and I wish no additional compile-time checks.
compile
raygui.h
to .DLL that refers tolibraylib.dll
Do you mean you want a Linux version of it? On Linux shared libraries have .so
extension and on Windows there's no libraylib.dll
file, I'm a little confused. If you want a Linux version of shared library for raygui, you can download it here: https://github.com/greenfork/nimraylib_now/releases/tag/v0.4.0
I'm a little confused.
So are me. Back in 3.0 times and before, there was pretty consistent libraylib.dll
available in Windows distribution: https://github.com/raysan5/raylib/releases/download/3.0.0/raylib-3.0.0-Win64-mingw.zip
Now it's called raylib.dll
, yet Linux version is still libraylib.so
and so is MacOS one. So, I decided to keep my wrapper with old library naming convention.
On other hand: nevermind. Your version works.
Now it's called
raylib.dll
As I understand, this is the "conventional" naming for Windows libraries. Considering that you build the latest version from master, changing the name might be the "right" thing to do.
Regarding linking to libraylib.dll
- I didn't really get it to work on Windows at all with building raygui as dll so I don't even know which -l
flag to pass. I don't have a Windows machine so I had to do remote debugging in this issue (branch which was at the start of the issue) and I didn't get all the details straight.
On other hand: nevermind. Your version works.
Currently our wrappers differ in these points:
#include
pragmas (which results in longer compilation times and requires header files present to compile the game; but speeds up startup time)I understand that my version might seem better in some aspects and it is in fact what I wanted to do, create a "better raylib-forever", I don't want to be a dick about it. I use c2nim
app to do code translation, your version does everything in CoffeeScript which is straight mind-blowing to me, I really admire your work there.
No, I was talking about your version of raygui.dll
<3.
Still, your wrapper is rather nice, I will look at example translation progress.
Okay, I might have misunderstood you there :)
My version is nothing special though, I just use standard raylib.dll
provided on raylib release page for 3.5
FYI, on Linux, I had to pass -DRAYGUIDEF
when I compiled the .so file in order to not make all the declarations static (so that they're actually possible to use with a shared lib)
Full command I used: gcc -shared -fPIC -DRAYGUIDEF -DRAYGUI_IMPLEMENTATION -lraylib -lGL -lm -lpthread -ldl -lrt -lX11 raygui.h -o raygui.so
I hope this helps someone else. Maybe it should be in the docs?
Edit: I also had to rename it from raygui.h
to raygui.c
or else GCC would refuse to compile it correctly.
Hi, there are a couple of errors trying to compile just generated files on linux:
Also, not a problem but
{.pragma: RLAPI, cdecl, discardable, dynlib: "libraylib" & LEXT.}
is generated twice on lines 75-76 inraylib.nim
.UPDATE: when compiling example from
examples/texture/image_processing.nim
, this chunk of code inraylib.nim
does not workit needs to be located below type definitions and be rewritten to forward all arguments, like this:
It was a bit hard for me to compile raygui library as a dynamic library with no previous experience of doing so, maybe it is helpful to at least leave some notes on how to do this. Here is what I did on linux, probably not ideal:
After that example from
examples/original/basic.nim
compiles with: