1. Sokol Wrapper Build Issue
- Posted by Icy_Viking 2 weeks ago
- 1408 views
Hi all,
I came across the "sokol" libraries and I think they'd be neat to use with Euphoria. Of course I need to make the wrappers first. However I am having trouble building 'sokol_app' It keeps coming up with these errors when I try to build it under mingw/gcc.
sokol app file: https://github.com/floooh/sokol/blob/master/sokol_app.h
Using OpenEuphoria 4.1.0 Beta 2 Windows 11 Pro
Errors: https://ibb.co/whDc3MbK
//Sokol_app.c file #define SOKOL_DLL #define SOKOL_APP_IMPL #define SOKOL_GLCORE #define SOKOL_NO_ENTRY #include "sokol_app.h"
gcc -c sokol_app.c - this builds/compiles fine gcc -shared -o sokol_app.dll sokol_app.o - this is what causes the errors to appear
2. Re: Sokol Wrapper Build Issue
- Posted by ghaberek (admin) 2 weeks ago
- 1377 views
I came across the "sokol" libraries and I think they'd be neat to use with Euphoria.
Neat! I will definitely dig into this further. I love little libraries like these.
However I am having trouble building 'sokol_app' It keeps coming up with these errors when I try to build it under mingw/gcc.
sokol app file: https://github.com/floooh/sokol/blob/master/sokol_app.h
Using OpenEuphoria 4.1.0 Beta 2 Windows 11 Pro
Errors: https://ibb.co/whDc3MbK
These are all part of the Windows GDI library:
- ChoosePixelFormat
- CreateBitmap
- CreateDIBSection
- DeleteObject
- DescribePixelFormat
- SetPixelFormat
- SwapBuffers
You need to tell GCC to link with that library when making your DLL, like this:
gcc -shared -o sokol_app.dll sokol_app.o -lgdi32
That being said, I'm not sure the sokol_app library is going to work this way. It wants to call a function named sokol_main within your C code, and you can't have a "main" function in a DLL. I can dig into it more to see how it implements this and look for a work-around.
-Greg
3. Re: Sokol Wrapper Build Issue
- Posted by Icy_Viking 2 weeks ago
- 1366 views
I came across the "sokol" libraries and I think they'd be neat to use with Euphoria.
Neat! I will definitely dig into this further. I love little libraries like these.
However I am having trouble building 'sokol_app' It keeps coming up with these errors when I try to build it under mingw/gcc.
sokol app file: https://github.com/floooh/sokol/blob/master/sokol_app.h
Using OpenEuphoria 4.1.0 Beta 2 Windows 11 Pro
Errors: https://ibb.co/whDc3MbK
These are all part of the Windows GDI library:
- ChoosePixelFormat
- CreateBitmap
- CreateDIBSection
- DeleteObject
- DescribePixelFormat
- SetPixelFormat
- SwapBuffers
You need to tell GCC to link with that library when making your DLL, like this:
gcc -shared -o sokol_app.dll sokol_app.o -lgdi32
That being said, I'm not sure the sokol_app library is going to work this way. It wants to call a function named sokol_main within your C code, and you can't have a "main" function in a DLL. I can dig into it more to see how it implements this and look for a work-around.
-Greg
Thanks Greg, adding the "lgdi32" worked. Also, the '#define SOKOL_NO_ENTRY' is used for when there is no main, to help build DLL.
4. Re: Sokol Wrapper Build Issue
- Posted by ghaberek (admin) 2 weeks ago
- 1350 views
Thanks Greg, adding the "lgdi32" worked.
Glad to hear.
Also, the '#define SOKOL_NO_ENTRY' is used for when there is no main, to help build DLL.
I noticed that after poking around a bit more. Hopefully that's all you need to make it usable!
-Greg
5. Re: Sokol Wrapper Build Issue
- Posted by Icy_Viking 2 weeks ago
- 1324 views
Thanks Greg, adding the "lgdi32" worked.
Glad to hear.
Also, the '#define SOKOL_NO_ENTRY' is used for when there is no main, to help build DLL.
I noticed that after poking around a bit more. Hopefully that's all you need to make it usable!
-Greg
Well I have finished wrapping the main sokol libraries. https://github.com/gAndy50/EuSokol
The DLLs are built and the Euphoria programs compile without issue. No examples yet. I'm a bit unsure on how to make some examples as the sokol libraries are pretty struct heavy. You'll also need to use the 64-bit version of Euphoria, just an FYI.