Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: DSFML2 Problems  (Read 27616 times)

0 Members and 1 Guest are viewing this topic.

atomen

  • Newbie
  • *
  • Posts: 17
    • View Profile
DSFML2 Problems
« on: October 15, 2010, 10:53:19 pm »
Hi everyone!

I'm using the following test code for my script:
Code: [Select]
module main;

import dsfml.graphics.all;
import dsfml.window.all;
import dsfml.system.all;

void main(string[] args)

{

RenderWindow app = new RenderWindow(VideoMode(800, 600, 32), "SFML D-Test");

while(app.isOpened())
{
app.clear(Color(255, 255, 255));
}
}
I've kept the code minimal to avoid errors though I have one.
Whenever I run the application I am met by the error
Quote
object.Error: Access Violation
An exception was thrown while finalizing an instance of class dsfml.graphics.renderwindow.RenderWindow
Any suggestions?

Trass3r

  • Jr. Member
  • **
  • Posts: 91
    • View Profile
DSFML2 Problems
« Reply #1 on: October 16, 2010, 05:13:18 pm »
Could you add a stacktrace?
I think druntime supports them on linux now and there is a third-party one for windows here: http://3d.benjamin-thaut.de/?p=15

atomen

  • Newbie
  • *
  • Posts: 17
    • View Profile
DSFML2 Problems
« Reply #2 on: October 16, 2010, 06:44:34 pm »
I shall quote from the website
Quote
The only point where this does not work is the Access Vioaltion error, as it does not call the stacktrace callback function for some reason.
Any other suggestions?

I'm not sure if you are required to link with any sfml libs or dlls.
During the compile process I do a regular compile excepting using -Ipath for the SFML Files.

Trass3r

  • Jr. Member
  • **
  • Posts: 91
    • View Profile
DSFML2 Problems
« Reply #3 on: October 16, 2010, 06:53:51 pm »
There is a solution for that:
Quote
I modified druntime to support stack-tracing for all kind of exceptions.  
 It's very simple:
 
 1) In object_.d, change traceContext() function linkage to C:
 extern(C) Throwable.TraceInfo traceContext(void* ptr = null) { ... }
 
 2) In rt\deh.c, declare
 Interface* traceContext(void* ptr);
 
 and add the following line to _d_create_exception_object (rt\deh.c)
 exc->info = traceContext(NULL);

Will probably be integrated into druntime some time soon.

The CSFML dlls are loaded at runtime.

atomen

  • Newbie
  • *
  • Posts: 17
    • View Profile
DSFML2 Problems
« Reply #4 on: October 16, 2010, 07:16:28 pm »
I did as you guided me and the compile works fine though I still don't get any
stacktrace output. Do I have to compile with -gc or -debug?

I haven't got wndbg to work for correctly for me.

EDIT: But aren't the CSFML dlls required to be in the same folder as the program executable then?

Trass3r

  • Jr. Member
  • **
  • Posts: 91
    • View Profile
DSFML2 Problems
« Reply #5 on: October 16, 2010, 07:31:56 pm »
Yeah of course you have to compile with -debug -g (or at least with -g I think) so the function names etc. are put into the executable.

Yes, your executable needs to find the dlls. Either in the same directory or on the PATH.

atomen

  • Newbie
  • *
  • Posts: 17
    • View Profile
DSFML2 Problems
« Reply #6 on: October 16, 2010, 09:11:43 pm »
Thank you for your effort Trass3r!

Finally I've got success- and helpful output messages and pathetically enough
I'd forgotten to place the csfml-xxx.dlls in the same directory as the executable.

Now one remaining question; where can I find those?
I can't seem to find'em at the SVN and I'm not able to compile'em either...

Trass3r

  • Jr. Member
  • **
  • Posts: 91
    • View Profile
DSFML2 Problems
« Reply #7 on: October 17, 2010, 01:52:09 pm »
Since there's no official release of 2.0 yet you need to compile them yourself, works flawlessly for me with Visual Studio or MinGW.

atomen

  • Newbie
  • *
  • Posts: 17
    • View Profile
DSFML2 Problems
« Reply #8 on: October 17, 2010, 01:58:08 pm »
This might supposed to be in the C-Section though I'll ask you for help anyway.
When I compile (VS2008) I get these errors:
Quote

2>RenderWindow.obj : error LNK2019: unresolved external symbol "public: void __thiscall sf::Window::Create(struct HWND__ *,struct sf::ContextSettings const &)" (?Create@Window@sf@@QAEXPAUHWND__@@ABUContextSettings@2@@Z) referenced in function _sfRenderWindow_CreateFromHandle
Quote
2>RenderWindow.obj : error LNK2019: unresolved external symbol "public: struct HWND__ * __thiscall sf::Window::GetSystemHandle(void)const " (?GetSystemHandle@Window@sf@@QBEPAUHWND__@@XZ) referenced in function _sfRenderWindow_GetSystemHandle
Any suggestions?

Trass3r

  • Jr. Member
  • **
  • Posts: 91
    • View Profile
DSFML2 Problems
« Reply #9 on: October 17, 2010, 04:00:12 pm »
No clue.
Maybe the project files aren't up-to-date anymore. Laurent wanted to switch to CMake.

atomen

  • Newbie
  • *
  • Posts: 17
    • View Profile
DSFML2 Problems
« Reply #10 on: October 17, 2010, 04:59:51 pm »
Stupid me.... I had not even compiled the SFML Libraries before I tried to compile the CSFML libraries.

In other words; everything is fully functional now!
Thans for your help Trass3r!

Trass3r

  • Jr. Member
  • **
  • Posts: 91
    • View Profile
DSFML2 Problems
« Reply #11 on: October 17, 2010, 05:19:17 pm »
You're welcome :)

RobotGymnast

  • Jr. Member
  • **
  • Posts: 56
    • View Profile
DSFML2 Problems
« Reply #12 on: January 31, 2011, 07:35:20 pm »
What am I supposed to call the SFML2 DLLs? I get access violations, and I've tried csfml-*-d-2.dll, sfml-*-d-2.dll, sfml-*-2.dll, and sfml-*.dll.

Trass3r

  • Jr. Member
  • **
  • Posts: 91
    • View Profile
DSFML2 Problems
« Reply #13 on: January 31, 2011, 07:40:15 pm »
Standard naming scheme csfml-*[-d]-2.dll

RobotGymnast

  • Jr. Member
  • **
  • Posts: 56
    • View Profile
DSFML2 Problems
« Reply #14 on: January 31, 2011, 07:52:52 pm »
Still not working - I copy-pasted the exact code from above, and ran the executable in a folder with the DLLs in it:

Code: [Select]

csfml-audio-d-2.dll
csfml-graphics-d-2.dll
csfml-system-d-2.dll
csfml-window-d-2.dll


Compiles fine, links fine, but doesn't run.