SFML community forums

Help => Graphics => Topic started by: Noah Klabo on July 23, 2014, 08:34:30 am

Title: Dll fails to load when contains SFML opengl functions
Post by: Noah Klabo on July 23, 2014, 08:34:30 am
Im working on an engine that loads a dll that contains all the GUI code, its works if I use
In DLL
 SFWindow = new sf::Window(sf::VideoMode(800, 600), Title);  
but will not load if I use
SFWindow = new sf::RenderWindow(sf::VideoMode(800, 600), Title);

the dll is compiled using
g++ -std=c++0x -shared -o Gui.x86.dll Gui/Gui_Interface.cpp  Gui/Gui_Gui.cpp Gui/Gui_Window.cpp  -Wl,-rpath,'$ORIGIN'  Common.x86.dll  
-lsfml-system -lsfml-graphics -lsfml-window -lOpengl32 -lGlu32


and loaded in main executable
                SharedLibrary GuiLib("Gui.x86","Init");
                InitGui = (GuiInterface (*)()) GuiLib.Function;
                Interface.Gui = InitGui();

I have no Idea why it is doing this thanks
Title: Re: Dll fails to load when contains SFML opengl functions
Post by: Hapax on July 24, 2014, 01:48:01 am
sf::Window needs the Window module; sf::RenderWindow needs the Graphics modules, which needs the window module so it must be the graphics module that is causing you a problem.
I would try to link them in the correct order. I'm not sure which way around it is in your compiler but it will probably be either:
-lGlu32 -lOpengl32 -lsfml-graphics -lsfml-window -lsfml-system
or
-lsfml-system -lsfml-window -lsfml-graphics -lOpengl32 -lGlu32
Title: Re: Dll fails to load when contains SFML opengl functions
Post by: Nexus on July 25, 2014, 11:04:37 pm
What does "will not load" mean? Is there an error?

On g++, dependent libraries have to be listed first, i.e. sfml-graphics before sfml-window before sfml-system.