Re: GtkD HelloWorld app crashes with exception

2013-05-18 Thread Enjoys Math
On Saturday, 18 May 2013 at 05:26:45 UTC, Alexandr Druzhinin 
wrote:

18.05.2013 9:52, Enjoys Math пишет:
I'm on Windows 7 64-bit and using DMD2, compiling a regular 
32-bit
windows app using Visual D New Project  Windows App and 
replacing

winmain.d with the code below:


 ...


I'm using GtkD-2.2.0 from here:
https://code.google.com/p/gtkd-packages/downloads/list

and also the 32-bit runtime from there.

The output when I click Start Debugging in Visual D is to 
display a
stdout window with some text (that I can't read since it's too 
fast.

I've tried setting breakpoints to no avail), no window is ever
displayed.  Then in Visual D the output log shows:

code
First-chance exception at 0x76c6c41f in WindowsApp1.exe: 
0xE0440001:

0xe0440001.
The program '[3848] WindowsApp1.exe: Native' has exited with 
code 1 (0x1).

/code

Thank you for any suggestions.
Works fine on my box. You have problem with gtk installation. 
But I can't specify what's the reason - I downloaded previous 
binaries. Also I recommend you to experiment with paths - check 
it out.


I installed 2.24 from here:
https://code.google.com/p/gtkd-packages/downloads/list

And the windows 7 path is set correctly to the Gtk-Runtime\bin 
folder.


But the same problem persists.


Re: GtkD HelloWorld app crashes with exception

2013-05-18 Thread Enjoys Math
Now the minimal example causing the error is a console app with 
code:



module main;
import std.stdio;

void main(string[] args)
{
readln();
}


When I link with GtkD.lib, the executable is broken.

I've tried using GtkD 1.7.2 from that same google code repo, but 
got errors trying to build it.


Thanks.


Re: GtkD HelloWorld app crashes with exception

2013-05-18 Thread Enjoys Math

I re-installed DMD 2.062 and now it's a compiler error:

-- Build started: Project: ConsoleApp3, Configuration: Debug 
Win32 --

Building Debug\ConsoleApp3.exe...
OPTLINK (R) for Win32  Release 8.00.12
Copyright (C) Digital Mars 1989-2010  All rights reserved.
http://www.digitalmars.com/ctg/optlink.html
C:\D\dmd2\windows\bin\..\lib\GtkD.lib(glib)
 Error 42: Symbol Undefined _D3std3utf10decodeImplFNaNePxakKkZw 
(pure @trusted dchar std.utf.decodeImpl(const(char)*, uint, ref 
uint))

C:\D\dmd2\windows\bin\..\lib\GtkD.lib(glib)
 Error 42: Symbol Undefined 
_D6object9Exception6__ctorMFAyaAyakC6object9ThrowableZC9Exception 
(Exception object.Exception.__ctor(immutable(char)[], 
immutable(char)[], uint, object.Throwable))

Building Debug\ConsoleApp3.exe failed!
Details saved as 
file://C:\home\Dropbox\Dev\AudioSynth\Tests\ConsoleApp3\ConsoleApp3\Debug\ConsoleApp3.buildlog.html


Re: GtkD HelloWorld app crashes with exception

2013-05-18 Thread Alexandr Druzhinin

18.05.2013 14:53, Enjoys Math пишет:

I re-installed DMD 2.062 and now it's a compiler error:

-- Build started: Project: ConsoleApp3, Configuration: Debug Win32
--
Building Debug\ConsoleApp3.exe...
OPTLINK (R) for Win32  Release 8.00.12
Copyright (C) Digital Mars 1989-2010  All rights reserved.
http://www.digitalmars.com/ctg/optlink.html
C:\D\dmd2\windows\bin\..\lib\GtkD.lib(glib)
  Error 42: Symbol Undefined _D3std3utf10decodeImplFNaNePxakKkZw (pure
@trusted dchar std.utf.decodeImpl(const(char)*, uint, ref uint))
C:\D\dmd2\windows\bin\..\lib\GtkD.lib(glib)
  Error 42: Symbol Undefined
_D6object9Exception6__ctorMFAyaAyakC6object9ThrowableZC9Exception
(Exception object.Exception.__ctor(immutable(char)[], immutable(char)[],
uint, object.Throwable))
Building Debug\ConsoleApp3.exe failed!
Details saved as
file://C:\home\Dropbox\Dev\AudioSynth\Tests\ConsoleApp3\ConsoleApp3\Debug\ConsoleApp3.buildlog.html

Try to rebuild GtkD if you re-installed dmd. Check if Gtk path is the 
first in path because can be other application with different version of Gtk


Re: GtkD HelloWorld app crashes with exception

2013-05-18 Thread Enjoys Math
On Saturday, 18 May 2013 at 07:59:49 UTC, Alexandr Druzhinin 
wrote:


Try to rebuild GtkD if you re-installed dmd. Check if Gtk path 
is the first in path because can be other application with 
different version of Gtk


Okay, I did both of those and got new errors:

:\D\dmd2\windows\bin\..\lib\GtkD.lib(glib)
 Error 42: Symbol Undefined 
_D4core6memory2GC6qallocFkkZS4core6memory8BlkInfo_ 
(core.memory.BlkInfo_ core.memory.GC.qalloc(uint, uint))

C:\D\dmd2\windows\bin\..\lib\GtkD.lib(glib)
 Error 42: Symbol Undefined _D4core6memory2GC6extendFPvkkZk (uint 
core.memory.GC.extend(void*, uint, uint))

C:\D\dmd2\windows\bin\..\lib\GtkD.lib(glib)
 Error 42: Symbol Undefined _D4core5bitop3bsrFNaNbkZi (pure 
nothrow int core.bitop.bsr(uint))

Building Debug\ConsoleApp3.exe failed!


Re: GtkD HelloWorld app crashes with exception

2013-05-18 Thread Enjoys Math
I'm guessing I should try building a Win32 app and maybe those 
symbols will then be defined.


Re: Find variable at run time

2013-05-18 Thread Dicebot

On Saturday, 18 May 2013 at 02:09:49 UTC, Josh wrote:
Bearophile, is your findVar an AA? It looks like it is, I just 
didn't think you could put refs in an AA.


Thanks

Josh


It is AA and it stores pointers, not references.

P.S. There can be found a lot of solutions but they will all do 
some kind of adding extra run time information, be it if chain 
or AA map. Local variable names exist only during compilation, in 
compiled binary those are just stack offsets so can't possibly 
find one based on run time value without that extra info.


Re: how to have alias this with an unaccessible member?

2013-05-18 Thread Dicebot

Will this do?



struct A(T)
{
private T x;

ref T get()
{
return x;
}

alias get this;
}

-


Re: GtkD HelloWorld app crashes with exception

2013-05-18 Thread Alexandr Druzhinin

18.05.2013 15:34, Enjoys Math пишет:


And the errors are:

OPTLINK (R) for Win32  Release 8.00.12
Copyright (C) Digital Mars 1989-2010  All rights reserved.
http://www.digitalmars.com/ctg/optlink.html
C:\D\dmd2\windows\bin\..\lib\GtkD.lib(ObjectG)
  Error 42: Symbol Undefined _D4core6memory2GC7addRootFxPvZv (void
core.memory.GC.addRoot(const(void*)))
C:\D\dmd2\windows\bin\..\lib\GtkD.lib(ObjectG)
  Error 42: Symbol Undefined _D4core6memory2GC10removeRootFxPvZv (void
core.memory.GC.removeRoot(const(void*)))
C:\D\dmd2\windows\bin\..\lib\GtkD.lib(glib)
  Error 42: Symbol Undefined
_D4core6memory2GC6qallocFkkZS4core6memory8BlkInfo_ (core.memory.BlkInfo_
core.memory.GC.qalloc(uint, uint))
C:\D\dmd2\windows\bin\..\lib\GtkD.lib(glib)
  Error 42: Symbol Undefined _D4core6memory2GC6extendFPvkkZk (uint
core.memory.GC.extend(void*, uint, uint))
C:\D\dmd2\windows\bin\..\lib\GtkD.lib(glib)
  Error 42: Symbol Undefined _D4core5bitop3bsrFNaNbkZi (pure nothrow int
core.bitop.bsr(uint))
Building Debug\WindowsApp2.exe failed!
Your compiler is installed incorrectly and can not find phobos  of 
appropriate version. Check it once again. In your case this error should 
appear with any other example. Check it too, if you want.


Re: how to have alias this with an unaccessible member?

2013-05-18 Thread Dicebot

Btw, fun fact. This code crashes 2.063 beta:



struct A(T)
{
private T x;
alias y = x;
alias y this;
}



dmd: aliasthis.c:114: virtual void AliasThis::semantic(Scope*): 
Assertion `t' failed.


Re: GtkD HelloWorld app crashes with exception

2013-05-18 Thread Enjoys Math
On Saturday, 18 May 2013 at 08:46:40 UTC, Alexandr Druzhinin 
wrote:


Your compiler is installed incorrectly and can not find phobos  
of appropriate version. Check it once again. In your case this 
error should appear with any other example. Check it too, if 
you want.


Okay, I've re-installed DMD, rebuilt GtkD, and installed GtkD.  
Now a Win32 app compiles but I get a sequence of error boxes that 
pop up before the program gets to main():


Unhandled exception at 0x75e3c41f in WindowsApp2.exe 0xE440001: 
0xe0440001


(I hit continue)

Unhandled exception at 0x75e3c41f in WindowsApp2.exe: 0xE0440001: 
0xe0440001.


(I hit continue)

Title: Entry Point Not Found
	The procedure entry point deflateSetHeader could not be located 
in the dynamic link library zlib1.dll.


(I hit OK)

Unhandled exception at 0x75e3c41f in WindowsApp2.exe: 0xE0440001: 
0xe0440001.


(I hit continue)

Title: Entry Point Not Found
	The procedure entry point deflateSetHeader could not be located 
in the dynamic link library zlib1.dll.


(I hit OK)

Unhandled exception at 0x75e3c41f in WindowsApp2.exe: 0xE0440001: 
0xe0440001.


(I hit continue)

Then main() is entered.


Re: GtkD HelloWorld app crashes with exception

2013-05-18 Thread Enjoys Math

Then upon continuing I get an infinitely repeating

Unhandled exception at 0x in WindowsApp2.exe: 0xC005:
Access violation reading location 0x.

message box popping up.


Re: GtkD HelloWorld app crashes with exception

2013-05-18 Thread Alexandr Druzhinin

18.05.2013 16:17, Enjoys Math пишет:

Then upon continuing I get an infinitely repeating

Unhandled exception at 0x in WindowsApp2.exe: 0xC005:
Access violation reading location 0x.

message box popping up.
Did you check that path to Gtk runtime binaries is the first? I guess 
there is some other application in your path variable that is using 
different zlib1.dll and when you run your app it load incorrect version 
that results in what you get. Check you path once again.


Re: GtkD HelloWorld app crashes with exception

2013-05-18 Thread Mike Wey

On 05/18/2013 08:57 AM, Enjoys Math wrote:

On Saturday, 18 May 2013 at 05:26:45 UTC, Alexandr Druzhinin wrote:

18.05.2013 9:52, Enjoys Math пишет:

I'm on Windows 7 64-bit and using DMD2, compiling a regular 32-bit
windows app using Visual D New Project  Windows App and replacing
winmain.d with the code below:


 ...


I'm using GtkD-2.2.0 from here:
https://code.google.com/p/gtkd-packages/downloads/list

and also the 32-bit runtime from there.

The output when I click Start Debugging in Visual D is to display a
stdout window with some text (that I can't read since it's too fast.
I've tried setting breakpoints to no avail), no window is ever
displayed.  Then in Visual D the output log shows:

code
First-chance exception at 0x76c6c41f in WindowsApp1.exe: 0xE0440001:
0xe0440001.
The program '[3848] WindowsApp1.exe: Native' has exited with code 1
(0x1).
/code

Thank you for any suggestions.

Works fine on my box. You have problem with gtk installation. But I
can't specify what's the reason - I downloaded previous binaries. Also
I recommend you to experiment with paths - check it out.


I installed 2.24 from here:
https://code.google.com/p/gtkd-packages/downloads/list

And the windows 7 path is set correctly to the Gtk-Runtime\bin folder.

But the same problem persists.


GtkD 2.x wraps Gtk+ 3.x so you will need the 3.8 runtime from: 
https://code.google.com/p/gtkd-packages/downloads/list


I will check out why it doesn't print the error message about not being 
able to find the Gtk3 dll.


--
Mike Wey


Re: Compiler bug ?

2013-05-18 Thread Timon Gehr

On 05/17/2013 07:19 PM, bearophile wrote:

Jonathan M Davis:


However, if it _never_ makes sense to declare a variable
beginning with two underscores, I don't know why the compiler wouldn't
forbid
it other than the fact that it probably inserts such variables prior
to when
it would do the semantic analysis to check whether variables started with
underscores, in which case, catching the user's variables that start
with two
underscores while permitting the compiler's variables could get tricky.


I think to answer this issue we need someone that knows more about the
DMD compiler (as Kenji Hara). I think that if we want to forbid those
variables in user code, then probably there is a way do to it.

Bye,
bearophile


It is trivial to catch them in the parser.


Re: Compiler bug ?

2013-05-18 Thread bearophile

Timon Gehr:


It is trivial to catch them in the parser.


So the question is: is it right to catch them all? :-)

Bye,
bearophile


Re: GtkD HelloWorld app crashes with exception

2013-05-18 Thread Enjoys Math

On Saturday, 18 May 2013 at 10:47:13 UTC, Mike Wey wrote:
GtkD 2.x wraps Gtk+ 3.x so you will need the 3.8 runtime from: 
https://code.google.com/p/gtkd-packages/downloads/list


I will check out why it doesn't print the error message about 
not being able to find the Gtk3 dll.


I get the same errors except for the zlib ones when all 
Gtk-runtimes are uninstalled, so it seems like you're right that 
the runtime is not being found.


Okay, I've installed that 3.8 runtime, set both the user and 
system path vars at the beginnings and ends to have the 
runtime/bin dir.


Restarted Vis D.  Still have unhandled exceptions at run time.



Re: GtkD HelloWorld app crashes with exception

2013-05-18 Thread Enjoys Math

Should I try removing everything gtk-using and related from my
system?


Re: GtkD HelloWorld app crashes with exception

2013-05-18 Thread Mike Wey

On Saturday, 18 May 2013 at 18:54:50 UTC, Enjoys Math wrote:

On Saturday, 18 May 2013 at 10:47:13 UTC, Mike Wey wrote:
GtkD 2.x wraps Gtk+ 3.x so you will need the 3.8 runtime from: 
https://code.google.com/p/gtkd-packages/downloads/list


I will check out why it doesn't print the error message about 
not being able to find the Gtk3 dll.


I get the same errors except for the zlib ones when all 
Gtk-runtimes are uninstalled, so it seems like you're right 
that the runtime is not being found.


Okay, I've installed that 3.8 runtime, set both the user and 
system path vars at the beginnings and ends to have the 
runtime/bin dir.


Restarted Vis D.  Still have unhandled exceptions at run time.


Try putting the path to the Gtk3 runtime at the start of the 
path, and then restart the machine and try again.


--
Mike Wey


Re: GtkD HelloWorld app crashes with exception

2013-05-18 Thread Enjoys Math

On Saturday, 18 May 2013 at 20:45:41 UTC, Mike Wey wrote:
Try putting the path to the Gtk3 runtime at the start of the 
path, and then restart the machine and try again.


--
Mike Wey


Okay, works now!

The last problem I had was with the path.  Solution:  place your 
runtime/bin dir (e.g. C:\Program Files (x86)\Gtk-Runtime\bin) at 
the beginning of the *System* path and not the *User* path 
variable.


Thanks all for the help, yo.



Re: Compiler bug ?

2013-05-18 Thread Ali Çehreli

On 05/18/2013 11:50 AM, bearophile wrote: Timon Gehr:

 It is trivial to catch them in the parser.

 So the question is: is it right to catch them all? :-)

I don't think so. Double underscores are reserved for the 
implementation, which includes the standard library. I don't think the 
compiler should know that it is compiling something that is part of Phobos.


It could even be a mixin that has such a variable that is implemented in 
Phobos. There is nothing wrong in reminder each other that a name is 
reserved. :)


Ali



Can't find GLU symbols when compiling SimpleGL.d found in GtkD/demos

2013-05-18 Thread Enjoys Math

The code is:

/*
 * This file is part of gtkD.
 *
 * dui is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as 
published by
 * the Free Software Foundation; either version 3 of the License, 
or

 * (at your option) any later version.
 *
 * dui is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General 
Public License

 * along with dui; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 
02110, USA

 */

module simpleGL.SimpleGL;

private import gdk.Event;
private import gtk.DrawingArea;
private import gtk.Main;
private import gtk.MainWindow;
private import gtk.Widget;
private import glgdk.GLConfig;
private import glgdk.GLContext;
private import glgdk.GLdInit;
private import glgdk.GLWindow;
private import glgtk.GLCapability;
private import gtkglc.glgdktypes;

private import gtkglc.gl;
private import gtkglc.glu;

/**
 * This is a Simple class extending the DrawingArea widget.
 * A really simple Demo illustrating OpenGL with GtkD
 * It uses the GLCapability mixin to add the GL capabilities to 
the widget.

 * This example is provided under the terms of the GPL License.
 * Note the initialization of the GLCapabilities on the 
constructor.

 *
 * @author p...@tuxfamily.org
 */
class SimpleGL : DrawingArea
{

GLfloat width;
GLfloat height;

	/** need to include the mixin to add GL capabilities to this 
widget */

mixin GLCapability;

/**
 * Construct a simple DrawingArea and sets the GLCapabilities
 */
this()
{
super(300, 300);
setGLCapability();  // set the GL capabilities for this 
widget
}

/**
 * put any gl initializations here
 * returns true to consume the event
 */
void initGL()
{
resizeGL(null);
}

/**
	 * This method is called every time the window must be paint or 
repaint

 * This is where you put the OpenGL call to draw something.
	 * This method call be called directly by the application 
without an event object

 * to force redrawing of the scene.
 * returns true to consume the event
 */
bool drawGL()
{
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity ();

gluLookAt(0, 0, 10, 0, 0, 0, 0, 1,0); //Set the camera position

//Just Draw a tri-colored triangle
glBegin(GL_TRIANGLES);
glColor3f(1.0f,0.0f,0.0f);
glVertex3f( 0.0f, 1.0f, 0.0f);
glColor3f(0.0f,1.0f,0.0f);
glVertex3f(-1.0f,-1.0f, 0.0f);
glColor3f(0.0f,0.0f,1.0f);
glVertex3f( 1.0f,-1.0f, 0.0f);
glEnd();

return true;
}

/**
 * This method is called when the window is resized
 * returns true to consume the event
 */
bool resizeGL(Event event = null)
{
GLfloat w;
GLfloat h;

if ( event is null || event.type != GdkEventType.CONFIGURE )
{
w = getWidth();
h = getHeight();
}
else
{
w = event.configure.width;
h = event.configure.height;
}

width = w;
height = h;

		glViewport (0, 0, cast(int)w, cast(int)h); //Adjust the 
viewport according to new window dimensions


/*
 * Update the projection Matrix accoding to the new dimension
 * and reset the OpenGL state to MODELVIEW
 */
glMatrixMode (GL_PROJECTION);
glLoadIdentity ();
gluPerspective(20, w/h, 0.1, 10);
glMatrixMode (GL_MODELVIEW);

return true;
}
}

void main(string[] args)
{
Main.init(args);

GLdInit.init(args);

SimpleGL simpleGL = new SimpleGL();
MainWindow window = new MainWindow(Simplest OpenGL Example);
window.add(simpleGL);
window.showAll();

Main.run();
}


The errors are:

Building Debug\SimpleGL.exe...
OPTLINK (R) for Win32  Release 8.00.12
Copyright (C) Digital Mars 1989-2010  All rights reserved.
http://www.digitalmars.com/ctg/optlink.html
Debug\SimpleGL.obj(SimpleGL)
 Error 42: Symbol Undefined _gluLookAt@72
Debug\SimpleGL.obj(SimpleGL)
 Error 42: Symbol 

Re: Can't find GLU symbols when compiling SimpleGL.d found in GtkD/demos

2013-05-18 Thread Enjoys Math
Don't know if this helps but I did a dumpbin on the original COFF 
glu32.lib and output is:


   Exports

   ordinalname

  _gluUnProject@48
  _gluTessVertex@12
  _gluTessProperty@16
  _gluTessNormal@28
  _gluTessEndPolygon@4
  _gluTessEndContour@4
  _gluTessCallback@12
  _gluTessBeginPolygon@8
  _gluTessBeginContour@4
  _gluSphere@20
  _gluScaleImage@36
  _gluQuadricTexture@8
  _gluQuadricOrientation@8
  _gluQuadricNormals@8
  _gluQuadricDrawStyle@8
  _gluQuadricCallback@12
  _gluPwlCurve@20
  _gluProject@48
  _gluPickMatrix@36
  _gluPerspective@32
  _gluPartialDisk@44
  _gluOrtho2D@32
  _gluNurbsSurface@44
  _gluNurbsProperty@12
  _gluNurbsCurve@28
  _gluNurbsCallback@12
  _gluNextContour@8
  _gluNewTess@0
  _gluNewQuadric@0
  _gluNewNurbsRenderer@0
  _gluLookAt@72
  _gluLoadSamplingMatrices@16
  _gluGetTessProperty@12
  _gluGetString@4
  _gluGetNurbsProperty@12
  _gluErrorUnicodeStringEXT@4
  _gluErrorString@4
  _gluEndTrim@4
  _gluEndSurface@4
  _gluEndPolygon@4
  _gluEndCurve@4
  _gluDisk@28
  _gluDeleteTess@4
  _gluDeleteQuadric@4
  _gluDeleteNurbsRenderer@4
  _gluCylinder@36
  _gluBuild2DMipmaps@28
  _gluBuild1DMipmaps@24
  _gluBeginTrim@4
  _gluBeginSurface@4
  _gluBeginPolygon@4
  _gluBeginCurve@4


Errors building GtkD on windows

2013-05-18 Thread Enjoys Math

Doing 'rdmd Build.d' gives:

Microsoft (R) Library Manager Version 11.00.50727.1
Copyright (C) Microsoft Corporation.  All rights reserved.

LINK : warning LNK4044: unrecognized option '/c'; ignored
LINK : fatal error LNK1104: cannot open file 'gtkd.lib'
Microsoft (R) Library Manager Version 11.00.50727.1
Copyright (C) Microsoft Corporation.  All rights reserved.

LINK : warning LNK4044: unrecognized option '/c'; ignored
LINK : fatal error LNK1104: cannot open file 'gtkdgl.lib'
Microsoft (R) Library Manager Version 11.00.50727.1
Copyright (C) Microsoft Corporation.  All rights reserved.

LINK : warning LNK4044: unrecognized option '/c'; ignored
LINK : fatal error LNK1104: cannot open file 'gtkdsv.lib'


Re: Errors building GtkD on windows

2013-05-18 Thread Enjoys Math
Well I can get it to build using the bud method provided but I 
was concerned that gtkgl wasn't built into the final lib, but 
just noticed that the .brf file includes the srcgl directory.  So 
surely gl stuff is included in the final GtkD.lib when budding?  
It's weird though that I need to include the libraries glu32.lib 
and opengl32.lib when building SimpleGL.d


Re: Find variable at run time

2013-05-18 Thread Josh

On Saturday, 18 May 2013 at 08:26:09 UTC, Dicebot wrote:

On Saturday, 18 May 2013 at 02:09:49 UTC, Josh wrote:
Bearophile, is your findVar an AA? It looks like it is, I just 
didn't think you could put refs in an AA.


Thanks

Josh


It is AA and it stores pointers, not references.

P.S. There can be found a lot of solutions but they will all do 
some kind of adding extra run time information, be it if 
chain or AA map. Local variable names exist only during 
compilation, in compiled binary those are just stack offsets so 
can't possibly find one based on run time value without that 
extra info.


Ah, thanks for that.

Josh