www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Program exited with code -11

reply Alex <bomdia protonmail.ch> writes:
Hello guys.

I am beginner with D and a hobbyist in general when it comes to 
programming. I am following an SFML tutorial in C++ and trying to 
"translate it" to D (at least the parts I think I understand). I 
am using Derelict SFML2 bindgings to CSFML.

First I tried to do it procedural way and it works fine:

http://pastebin.com/6PjRCUHp

Then I tried an OOP way as per tutorial:

app.d =

module app;
import notquiteciv.game;

void main()
{
     Game game = new Game();

     game.gameLoop();
}

game.d = http://pastebin.com/ps9mMxGf

When I run "dub run" or "dub run --force", I get this:

Running ./notquiteciv
Program exited with code -11

$ lldb ./notquiteciv (run)

Process 81278 launched: './notquiteciv' (x86_64)
Process 81278 stopped
* thread #1: tid = 0x14dae3, 0x0000000000000000, queue = 
'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, 
address=0x0)
     frame #0: 0x0000000000000000
error: memory read failed for 0x0

I am stuck. Can you give me a hint regarding this?

Thank you.
Nov 26 2015
parent reply Rikki Cattermole <alphaglosined gmail.com> writes:
On 26/11/15 9:12 PM, Alex wrote:
 Hello guys.

 I am beginner with D and a hobbyist in general when it comes to
 programming. I am following an SFML tutorial in C++ and trying to
 "translate it" to D (at least the parts I think I understand). I am
 using Derelict SFML2 bindgings to CSFML.

 First I tried to do it procedural way and it works fine:

 http://pastebin.com/6PjRCUHp

 Then I tried an OOP way as per tutorial:

 app.d =

 module app;
 import notquiteciv.game;

 void main()
 {
      Game game = new Game();

      game.gameLoop();
 }

 game.d = http://pastebin.com/ps9mMxGf

 When I run "dub run" or "dub run --force", I get this:

 Running ./notquiteciv
 Program exited with code -11

 $ lldb ./notquiteciv (run)

 Process 81278 launched: './notquiteciv' (x86_64)
 Process 81278 stopped
 * thread #1: tid = 0x14dae3, 0x0000000000000000, queue =
 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
      frame #0: 0x0000000000000000
 error: memory read failed for 0x0

 I am stuck. Can you give me a hint regarding this?

 Thank you.
You forgot to load the pointers to the functions in the shared library :) https://github.com/DerelictOrg/DerelictSFML2
Nov 26 2015
parent Alex <bomdia protonmail.ch> writes:
On Thursday, 26 November 2015 at 08:15:02 UTC, Rikki Cattermole 
wrote:
 You forgot to load the pointers to the functions in the shared 
 library :)

 https://github.com/DerelictOrg/DerelictSFML2
OMG. I am embarrassed. Thank you very much.
Nov 26 2015