SFML community forums

Bindings - other languages => D => Topic started by: salamander on November 06, 2012, 07:16:20 pm

Title: problem when compiling derelict3 sfml2 wrong dll
Post by: salamander on November 06, 2012, 07:16:20 pm
Hello,
 I'm trying to compile a program with the derelict3-sfml2-bindings. I use Mono-Develop, DMD-Compiler and Windows7 32-bit. I can compile the code without any errors, but when I try to run the program a command-window shows up with the message :

"Failed to load symbol sfWindow_setSize from shared library csfml-window-2.dll".

It appears that I have the wrong dll-Files in my app-directory. I have the dlls from the csfml-version2.0, from this site: http://www.sfml-dev.org/download.php.
Does anybody know where I can get the right dlls from.

Here is my Code :

module main;

import std.stdio;
import derelict.sfml2.window;
import derelict.sfml2.windowtypes;
import derelict.sfml2.windowfunctions;

void main(string[] args)
{
   DerelictSFML2Window.load();

   
   sfVideoMode mode = {500,500,32};
   const char* title = std.string.toStringz("hello");
   
   sfWindow* window = sfWindow_create(mode, title, sfResize| sfClose, null);
   
   sfEvent event;
   
   while (sfWindow_isOpen(window))
     {
         while (sfWindow_pollEvent(window, &event))
         {
             if (event.type == sfEvtClosed)
                 sfWindow_close(window);
         }
 
 
   
         sfWindow_display(window);
     }   
   
   sfWindow_destroy(window);
      
}




Title: Re: problem when compiling derelict3 sfml2 wrong dll
Post by: Nekroze on November 08, 2012, 06:06:57 am
I have recently gone through this proccess myself. The problem is with the latest csfml2 binaries.

What has to be done is you must first download the source snapshot for sfml2 c++ version on the download page near the top where it says SFML 2.0 snapshot.

Then you must compile that as static with cmake.

then get the latest CSFML2 sources here https://github.com/SFML/CSFML (https://github.com/SFML/CSFML)

then compile that with cmake aswell but NOT as static just normal dlls. then use those dll's and it will work.

It was a PAIN to get that all working fine but its worth it.

But also beware of a little problem with derelict3 bindings atm it has functions included that the current csfml2 dlls that you will build do not have. I have outlined them here https://github.com/aldacron/Derelict3/issues/62 (https://github.com/aldacron/Derelict3/issues/62) the solution is rather simple unless ofcause you need those functions.

Hope this helps mate, stick with it.
Title: Re: problem when compiling derelict3 sfml2 wrong dll
Post by: salamander on November 09, 2012, 12:12:52 pm
Thanks for the answer, but i couldn't manage to compile csfml, its really a pain. I think I will use Derelict2 and sfml1.6.
Title: Re: problem when compiling derelict3 sfml2 wrong dll
Post by: Nekroze on November 09, 2012, 02:09:00 pm
Here mate, download my compiled binaries, asuming thats permitted: https://dl.dropbox.com/u/27223793/CSFML2.7z (https://dl.dropbox.com/u/27223793/CSFML2.7z) They work fine with derelict3.

I if there is a problem with me sharing these i will take them down immediately, just say so.
Title: Re: problem when compiling derelict3 sfml2 wrong dll
Post by: salamander on November 09, 2012, 04:17:12 pm
Thank you for the binaries. I will try them out.
Title: Re: problem when compiling derelict3 sfml2 wrong dll
Post by: bobiniki on December 12, 2012, 06:26:56 pm
Can you upload those csfml builds you made because I have the exact same problem and I can't build the c++ and c libs.
Title: Re: problem when compiling derelict3 sfml2 wrong dll
Post by: Jbolte on December 12, 2012, 07:10:41 pm
Can you upload those csfml builds you made because I have the exact same problem and I can't build the c++ and c libs.

I would also appreciate them. I spent two hours last night just trying to build the libraries; the C++ libs were quite quick and easy following the tutorial, but the rest of the time was spent attempting to just configure cmake for the C libs (not even building them).

EDIT: Well, in the time since I posted this message I managed to get cmake working just great. I'll edit again shortly with the build I get, to see if it helps you any.

EDIT 2: After a lot of confusion with MingW (I rarely ever use this stuff xD) and a well needed break, I got CSFML built finally. It solves the problem with sfRenderWindow_setSize in the latest master of Derelict3, but has another with sfRenderTexture_convertCoords. I'm still trying to make this work though.
Title: Re: problem when compiling derelict3 sfml2 wrong dll
Post by: Jbolte on December 12, 2012, 11:52:55 pm
Hello, I have finally managed to build CSFML (excluding docs) to be usable with Derelict3. I have also updated the Derelict3 binding of SFML to match the current CSFML master, and I sent a pull request to Aldacron for the Derelict3 master.

My CSFML build is at https://dl.dropbox.com/u/19250085/CSFML.rar (https://dl.dropbox.com/u/19250085/CSFML.rar). My Derelict3 repo is at https://github.com/TheLionsRoar/Derelict3. Everything seems to work fine with my tests, but if something goes wrong for others I will do my best to help. I'm very new at this. :)
Title: Re: problem when compiling derelict3 sfml2 wrong dll
Post by: Jebbs on December 13, 2012, 04:09:18 am
That's awesome!

What compiler did you use?

I'm still having some strange issues getting CMake to work. It can't seem to find my compiler or something. Any advice for how you did it?

Edit:
Just kidding. After doing some good research and dedicating some time to it, I got it to work!
Title: Re: problem when compiling derelict3 sfml2 wrong dll
Post by: Jbolte on December 13, 2012, 02:38:56 pm
Hey, that's great that you got it built. I'll write up some instructions for how I did everything (I used MinGW) sometime soon. Everything is on this forums and the regular SFML cmake tutorial, just not in one place (and it's easy to miss one very important detail).

Also, I realized that I made a couple of mistakes with my CSFML build I linked to in my last post. Those should be fixed in this new build. https://dl.dropbox.com/u/19250085/CSFML.rar (same link as before)
Title: Re: problem when compiling derelict3 sfml2 wrong dll
Post by: bobiniki on December 13, 2012, 02:43:18 pm
Wow thanks dude it works now. :D
Title: Re: problem when compiling derelict3 sfml2 wrong dll
Post by: Jebbs on December 15, 2012, 08:24:52 am
@Jbolte

Since you are already making updates to the Derelict library, I'd like to point out that it is still missing the functions sfMouse_getPositionRenderWindow and sfMouse_setPositionRenderWindow from the graphics package!

Figured it would be easier for you to do than for me :P
Title: Re: problem when compiling derelict3 sfml2 wrong dll
Post by: Jbolte on December 15, 2012, 04:16:20 pm
Ah, I didn't check for missing functions. I only went through CSFML's commit history and made only the changes that were made since Derelict's SFML binding was last updated. I'll definitely add those and check for any others soon. :)