Shared library for Linux & MacOSX?

nobody wrote on Wednesday, November 29, 2006:

I’m currently using glfw.DLL on Win32 and it works very well.
Now I’d like to port my application to Linux and MacOSX with shared library.
Is there any way to build shared library version for Linux and MacOSX?
Has anyone ever done this before?
I have limited experienced in Linux/MacOSX.
Any assistance would be much appreciated.

elmindreda wrote on Wednesday, November 29, 2006:

The upcoming 2.6 branch (which is in CVS) has support for building shared libraries on Linux and Mac OS X, but why would you want to? GLFW is very suitable for static linking and especially for Linux, static linking makes both the distribution and the running of your application much simpler.

nobody wrote on Thursday, November 30, 2006:

Thanks for the fast reply.
I’m wondering when 2.6 RC or beta would be officially announced?
I’ll definitely check out CVS code first.

I need shared library version because I program in C#/Mono.NET and GLFW via Tao framework binding.
It must be a dynamic/shared library to be able to use P/Invoke for C/C++ code.
Otherwise, I have to create a stub DLL which is statically linked with GLFW and then do P/Invoke with that stub DLL.

elmindreda wrote on Thursday, November 30, 2006:

I’m not sure when a beta will be out. I do know that I’m busy with lectures until the 8th of December, but am longing to get back to work on GLFW as soon as they’re done.

Note that the code is still under the BRANCH_2_6 branch.

Ah, I see. That’s a good reason to use it ^^

nobody wrote on Friday, December 01, 2006:

I signed up the dev and user mailing list to see if I could help something.
So glad that GLFW is back and ongoing.
Thanks for your devotion sincerely! :slight_smile:

elmindreda wrote on Friday, December 01, 2006:

Cool. Welcome! Note that I’ll be away for another week, though.

nobody wrote on Sunday, December 03, 2006:

I too am interested in a shared library for OS X, while I have managed to make one it doesn’t work in windowed mode. There is no focus for the window so you can’t move it arround, or give input to it, fullscreen mode works however. Here is the diff to use for the Makefile to make it a shared library:

20c20
< CFLAGS = -c -I. -I… -Wall -Os

> CFLAGS = -fPIC -c -I. -I… -Wall -Os
30,31c30,31
< MKLIB = ar
< LIBFLAGS = -rcs

> MKLIB = gcc
> LIBFLAGS = -single_module -dynamiclib -framework Carbon -framework AGL -framework OpenGL -o libglfw.dylib
64,66c64
< $(MKLIB) $(LIBFLAGS) $@ $(OBJS)
< $(RANLIB) $@
<

> $(MKLIB) $(LIBFLAGS) $(OBJS)

If you gave me some insight on why it’s not currently working in windowed mode then I would be glad to help make those changes, btw this is the cvs version.

elmindreda wrote on Sunday, December 03, 2006:

That is a known problem in OS X and is not related to the way you’re linking against GLFW. OS X is not recognising it as a desktop application. You need to either put it into an application bundle or create a resource fork on it. Have a look at the GLFW examples.

nobody wrote on Monday, January 22, 2007:

Leaving aside the general, well-known advantages of having a shared library, one specific reason I’d like a shared library on Linux is so I can use GLFW with my favourite language/compiler, Free Pascal. Once version 2.6 of GLFW is released I plan to make available to my fellow Free Pascal users a conversion of the GLFW header. The more GLFW users, the better.

elmindreda wrote on Sunday, January 28, 2007:

The 2.6 release builds shared libraries for all platforms. Hopefully it’ll be out soon, but for now it’s in CVS.

nobody wrote on Thursday, March 29, 2007:

I have problem in porting on Mac OS X a glfw applicationt that works fine under Windows and Linux. In particular the windows appear to not process the events coming from mouse and keyboard. I don’t undertand why the example wokrs fine.

elmindreda wrote on Friday, March 30, 2007:

For the Mac OS X window manager to fully recognise your application, you need to either add a resource fork to the binary with Rez(1) or preferably put it into an application bundle. You can read more about application bundles at the Apple Developer Connection. There is also a script for creating simple bundles in the examples directory of your GLFW distribution.