Re: Using Cairo library bindings on Windows

2012-09-28 Thread Andrej Mitrovic
On 9/28/12, Andrej Mitrovic wrote: > I have some win32 cairo samples on my github page. Here you go: https://github.com/AndrejMitrovic/cairoDSamples Just follow the readme instructions.

Re: Using Cairo library bindings on Windows

2012-09-28 Thread Andrej Mitrovic
On 9/28/12, Andrej Mitrovic wrote: > On 9/28/12, Andrej Mitrovic wrote: >> I have some win32 cairo samples on my github page but I have to >> updated them first, they don't compile anymore (oops!). I'll do this >> within the hour. > > Man I'm getting linker errors, WinAPI errors when registering

Re: Using Cairo library bindings on Windows

2012-09-28 Thread Andrej Mitrovic
On 9/28/12, Andrej Mitrovic wrote: > I have some win32 cairo samples on my github page but I have to > updated them first, they don't compile anymore (oops!). I'll do this > within the hour. Man I'm getting linker errors, WinAPI errors when registering WndProc and app crashes on exit. This all us

Re: compiler assertion

2012-09-28 Thread Zhenya
On Friday, 28 September 2012 at 20:27:07 UTC, Jonathan M Davis wrote: On Friday, September 28, 2012 22:19:56 Zhenya wrote: Hi! Is it normally,that this simple code does'nt compile with this assertion: dmd: template.c:5542: Identifier* TemplateInstance::genIdent(Objects*): Assertion `global.error

Re: compiler assertion

2012-09-28 Thread Jonathan M Davis
On Friday, September 28, 2012 22:19:56 Zhenya wrote: > Hi! > Is it normally,that this simple code does'nt compile with this > assertion: > dmd: template.c:5542: Identifier* > TemplateInstance::genIdent(Objects*): Assertion `global.errors' > failed. It's always a bug in the compiler if you see a co

compiler assertion

2012-09-28 Thread Zhenya
Hi! Is it normally,that this simple code does'nt compile with this assertion: dmd: template.c:5542: Identifier* TemplateInstance::genIdent(Objects*): Assertion `global.errors' failed. import std.stdio; import std.typetuple; template sum(T:TypeTuple!U,U...) { static if(U.length == 0)

Re: How to register class member function as lpfnWndProc? Cannot convert delegate to function

2012-09-28 Thread Maxim Fomin
On Friday, 28 September 2012 at 17:53:59 UTC, deed wrote: Hi I am trying to register a class member function as wc.lpfnWndProc, but get the error message "cannot implicitly convert expression (&this.WndProc) of type extern (Windows) int delegate(...) to extern (Windows) int function(...). I

Re: How to register class member function as lpfnWndProc? Cannot convert delegate to function

2012-09-28 Thread Jesse Phillips
On Friday, 28 September 2012 at 17:53:59 UTC, deed wrote: (Defining wndProc as a global function works, but is not what I want to do...) What is the issue here and how do I make it work? You are interfacing with C, which does not support functions with state (delegate). You must pass it a fu

Windows MinGW and DMD

2012-09-28 Thread David
So I want to make the compilation of my little game work on Windows, I set up MinGW with Msys and ran the makefile, after a few fixes compilation worked, the problem is linking fails hard. I need a few external libraries in C like glfw3 and openssl, latter I installed with `mingw-get install m

Re: Is it possible to force CTFE?

2012-09-28 Thread Tommi
On Friday, 28 September 2012 at 17:52:55 UTC, Tommi wrote: In a perfect world, I think, the compiler would always evaluate all possible functions at compile-time, given that doing so would produce a smaller (or equal size) executable than what not-evaluating-at-compile-time would produce. Or

Re: read single characters from stdin

2012-09-28 Thread 1100110
On Wed, 26 Sep 2012 13:06:03 -0500, Adam D. Ruppe wrote: On Wednesday, 26 September 2012 at 17:51:03 UTC, Thomas Koch wrote: How can I read single characters? The way I'd do it is with the C call fgetc(stdin). You can do it in D the same way if you import core.stdc.stdio; But, if you a

Re: Using Cairo library bindings on Windows

2012-09-28 Thread Andrej Mitrovic
On 9/28/12, KillerSponge wrote: > snip Well first of those bindings are broken. The _deprecated.d file is missing a module declaration. Secondly the wrapper module is using extern(System) instead of extern(C) which is why those symbols have @4 appended to them. There are object-oriented multi-p

How to register class member function as lpfnWndProc? Cannot convert delegate to function

2012-09-28 Thread deed
Hi I am trying to register a class member function as wc.lpfnWndProc, but get the error message "cannot implicitly convert expression (&this.WndProc) of type extern (Windows) int delegate(...) to extern (Windows) int function(...). I have: extern (Windows) class App { HRESULT initialize

Re: Is it possible to force CTFE?

2012-09-28 Thread Tommi
One use case I can think of for specializing functions based on whether or not its arguments are compile-time evaluable: // Big container that can't be accessed in constant time: immutable cachedResults = init(); double getResult() if (areCompileTimeConstants!() == false) { return cache

Using Cairo library bindings on Windows

2012-09-28 Thread KillerSponge
Hi all, I'm fairly new to D, but so far everything has been going pretty smooth. I come from a C(++) background under Linux, so I'm used to having to specify the name of the needed .so, and the include directory of the headers when using an external library. I am now trying to build a small

Re: Something wrong with std.math.pow?

2012-09-28 Thread Jesse Phillips
On Friday, 28 September 2012 at 05:35:13 UTC, Jesse Phillips wrote: Specifically, shouldn't 2^48 be a little bit larger than 0? After heading to bed I realized that I could no longer rely on compile-time type selection since I was calling a function. So obviously the number I was looking for

Re: Something wrong with std.math.pow?

2012-09-28 Thread Jesse Phillips
On Friday, 28 September 2012 at 05:46:49 UTC, Tim wrote: From what I understand, pragma(msg, ...) prints at compile time. I don't think that it evaluates functions then. In order to print it must have a value to print, so D makes its great attempt to run whatever it can at compile time to get

Re: read single characters from stdin

2012-09-28 Thread Jacob Carlborg
On 2012-09-26 19:51, Thomas Koch wrote: Hi, to learn D, I'd like to write a simple type trainer. It should write a line to stdout and then read single characters from stdin and only accept the correct characters How can I read single characters? A similar question has been asked before without

Re: read single characters from stdin

2012-09-28 Thread nazriel
On Friday, 28 September 2012 at 09:45:30 UTC, Thomas Koch wrote: nazriel wrote: http://dpaste.dzfl.pl/eb1387cc Thank you. Your solution does not seem to work with multibyte characters, so I extended it: Nice, I didn't need multibyte support as I was using it mainly for getting keycode

Re: read single characters from stdin

2012-09-28 Thread Thomas Koch
nazriel wrote: > http://dpaste.dzfl.pl/eb1387cc Thank you. Your solution does not seem to work with multibyte characters, so I extended it: import core.sys.posix.termios; import core.stdc.stdio; char getch() { int ch; termios oldt; termios newt; tcgetattr(0, &o

Re: read single characters from stdin

2012-09-28 Thread Thomas Koch
Ali Çehreli wrote: > Considering that stdin is a char stream and that there is no concept of > a keyboard or a monitor in D (nor in C and nor in C++), I stand by my > solution from that thread: :) Thank you, especially for the link, but your proposal still requires to press enter. Regards, Thomas