www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Derelict GLFW3 and dynamic linking on Linux

reply Kayomn <spam kayomn.net> writes:
Hi, I've been working on something using Windows and now I'm 
attempting to build it on Linux with Dub, however I appear to be 
having an issue.

import base.application;

import derelict.opengl3.gl3;
import derelict.glfw3.glfw3;

int main(string[] args) {
	DerelictGL3.load();

	version (Windows) {
		DerelictGLFW3.load(".\\dll\\glfw3.dll");
	} else {
		DerelictGLFW3.load("/usr/lib/x86_64-linux-gnu/libglfw.so");
	}
	return Application(args).run();
}

I've checked that the provided library object referenced exists, 
regardless every time I compile I get this same symbol loading 
error without fail:

derelict.util.exception.SymbolLoadException ../../.dub/packages/derelict-util-2.0.6/source/derelict/u
il/exception.d(35): Failed to load symbol glfwSetWindowIcon from shared library
/u
sr/lib/x86_64-linux-gnu/libglfw.so.3.1

I was reading this GitHub issue, and they seemed to describe the 
issue as being version incompatibilities:
https://github.com/DerelictOrg/DerelictGLFW3/issues/9

However, I'm certain I'm using the correct GLWF version for my 
project.
Feb 27 2018
parent reply Mike Parker <aldacron gmail.com> writes:
On Tuesday, 27 February 2018 at 12:00:20 UTC, Kayomn wrote:

 derelict.util.exception.SymbolLoadException ../../.dub/packages/derelict-util-2.0.6/source/derelict/u
il/exception.d(35): Failed to load symbol glfwSetWindowIcon from shared library
/u
 sr/lib/x86_64-linux-gnu/libglfw.so.3.1

 I was reading this GitHub issue, and they seemed to describe 
 the issue as being version incompatibilities:
 https://github.com/DerelictOrg/DerelictGLFW3/issues/9

 However, I'm certain I'm using the correct GLWF version for my 
 project.
It *is* a version problem. The exception is a SymbolLoadException, which means the loader found the library just fine (you can see it in the file name, libglfw.so.3.1). However, it attempted to load `glfwSetWindowIcon` and failed. If you check the GLFW 3 documentation [1] you'll find the following: ===== Since Added in version 3.2. ===== Then, going to the DerelictGLFW3 documentation [2], you can see that DerelictGLFW3 2.0.0 was the last version to support 3.1. However, you can still use the latest version of the Derelict binding with GLFW 3.1 if you ignore the functions from 3.2. You can do this via the selective loading mechanism [3]. Of course, if you need any functions from 3.2, then you should update your local version of GLFW. [1] http://www.glfw.org/docs/latest/group__window.html#gadd7ccd39fe7a7d1f0904666ae5932dc5 [2] http://derelictorg.github.io/packages/glfw3/ [3] http://derelictorg.github.io/loading/failure/#selective-symbol-loading
Feb 27 2018
parent Kayomn <spam kayomn.net> writes:
On Tuesday, 27 February 2018 at 13:14:38 UTC, Mike Parker wrote:
 On Tuesday, 27 February 2018 at 12:00:20 UTC, Kayomn wrote:

 [...]
It *is* a version problem. The exception is a SymbolLoadException, which means the loader found the library just fine (you can see it in the file name, libglfw.so.3.1). However, it attempted to load `glfwSetWindowIcon` and failed. If you check the GLFW 3 documentation [1] you'll find the following: [...]
Thanks for clearing that up, it's been bugging me for a while.
Feb 27 2018