Re: Calling D from C

2013-11-23 Thread Jesse Phillips
On Sunday, 24 November 2013 at 05:54:44 UTC, evilrat wrote: On Sunday, 24 November 2013 at 05:25:36 UTC, CJS wrote: bash calls: dmd -c foo.d gcc bar.c foo.o this is wrong. there should flag for building static lib which should produce foo.a which then you link with C build. There isn't an

Re: Calling D from C

2013-11-23 Thread evilrat
On Sunday, 24 November 2013 at 05:25:36 UTC, CJS wrote: bash calls: dmd -c foo.d gcc bar.c foo.o this is wrong. there should flag for building static lib which should produce foo.a which then you link with C build.

Re: DStep

2013-11-23 Thread Craig Dillabaugh
On Saturday, 23 November 2013 at 20:16:32 UTC, Jacob Carlborg wrote: On 2013-11-22 15:35, Craig Dillabaugh wrote: I am trying to use DStep on OpenSuse 12.3. I downloaded one of the binaries (it was for Debian, so I guess that is my problem), and when I run DStep I get the following error: cr

Calling D from C

2013-11-23 Thread CJS
I haven't been able to make calling D from C on Mac OS 10.9 work. I tried the following simple example: foo.d import std.stdio; extern(C) int add(int x, int y){ return x + y; } bar.c #include int add(int , int); int main(){ int x = 1; int y = 2; char s[] = "%d + %d = %d"

Re: undefined reference to `_D16TypeInfo_HAyayAa6__initZ'

2013-11-23 Thread Adam D. Ruppe
On Sunday, 24 November 2013 at 03:41:20 UTC, Adam D. Ruppe wrote: enhancement request in bugzilla https://d.puremagic.com/issues/show_bug.cgi?id=11586

Re: undefined reference to `_D16TypeInfo_HAyayAa6__initZ'

2013-11-23 Thread Adam D. Ruppe
On Sunday, 24 November 2013 at 00:14:22 UTC, Jeroen Bollen wrote: Does yHAyaAa mean: immutable (immutable char)[char[]] Looks like you got the key and value backwards there and missed an 'A' too (I was just writing about this on SO too, but the comment limit meant I cut a bit short there).

Re: undefined reference to `_D16TypeInfo_HAyayAa6__initZ'

2013-11-23 Thread Adam D. Ruppe
On Sunday, 24 November 2013 at 00:01:32 UTC, Jeroen Bollen wrote: Your work actually inspired mine. I saw it used some external code so I am basically writing it without those. Oh cool!

Re: How to read \n from a string

2013-11-23 Thread H. S. Teoh
On Sun, Nov 24, 2013 at 01:40:43AM +0100, Stephen Jones wrote: > I want to be able to write a string containing \n to indicate > newline breaks, but I want the string to cover multiple lines for > example: > > string str = "This is just a little string I wrote\n to see if all > was upside down or

Re: How to read \n from a string

2013-11-23 Thread bearophile
Stephen Jones: I want to be able to write a string containing \n to indicate newline breaks, but I want the string to cover multiple lines for example: string str = "This is just a little string I wrote\n to see if all was upside down or not, or known to be back to front at all."; if I us

Re: How to read \n from a string

2013-11-23 Thread Jesse Phillips
On Sunday, 24 November 2013 at 00:41:00 UTC, Stephen Jones wrote: I want to be able to write a string containing \n to indicate newline breaks, but I want the string to cover multiple lines for example: string str = "This is just a little string I wrote\n to see if all was upside down or not,

How to read \n from a string

2013-11-23 Thread Stephen Jones
I want to be able to write a string containing \n to indicate newline breaks, but I want the string to cover multiple lines for example: string str = "This is just a little string I wrote\n to see if all was upside down or not, or known to be back to front at all."; if I use: foreach(c; str

Re: How to make delegate refer to itself?

2013-11-23 Thread bearophile
Ali Çehreli: Timon Gehr's improvement of the Y combinator: http://forum.dlang.org/post/l55gr6$1ltp$1...@digitalmars.com Nice, I will update the Rosettacode page. Bye, bearophile

Re: How to make delegate refer to itself?

2013-11-23 Thread Ali Çehreli
On 11/23/2013 02:57 PM, H. S. Teoh wrote: How do I make a delegate refer to itself? I'm running into a chicken-and-egg problem where a delegate needs to remove itself from an event queue, but I don't know how to make it refer to itself: queue.register((Event e) { if (e ==

Re: undefined reference to `_D16TypeInfo_HAyayAa6__initZ'

2013-11-23 Thread Jeroen Bollen
On Saturday, 23 November 2013 at 23:47:11 UTC, Adam D. Ruppe wrote: On Saturday, 23 November 2013 at 23:30:09 UTC, Jeroen Bollen wrote: I added the code to my GitHub repo; there don't seem to be any uncommon associative arrays: Yea, it is the immutable string[string], I used the same pattern

Re: How to make delegate refer to itself?

2013-11-23 Thread Ary Borenszweig
On 11/23/13 7:57 PM, H. S. Teoh wrote: void delegate(Event) dg = (Event e) { if (e == ...) queue.remove(dg); // NG: Still complains 'dg' isn't defined }; Split it in declaration and initialization: void delegate(Event) dg; dg = (Event e) {

Re: undefined reference to `_D16TypeInfo_HAyayAa6__initZ'

2013-11-23 Thread Jeroen Bollen
On Saturday, 23 November 2013 at 23:47:11 UTC, Adam D. Ruppe wrote: On Saturday, 23 November 2013 at 23:30:09 UTC, Jeroen Bollen wrote: I added the code to my GitHub repo; there don't seem to be any uncommon associative arrays: Yea, it is the immutable string[string], I used the same pattern

Re: OpenGL rendering issue

2013-11-23 Thread Mineko
On Saturday, 23 November 2013 at 22:41:41 UTC, Mikko Ronkainen wrote: Try moving glGenVertexArrays(1, &vao); glBindVertexArray(vao); at the top. You're my new best friend, no, let's get married. Really though, thanks, this one's been eating at me a bit.

Re: undefined reference to `_D16TypeInfo_HAyayAa6__initZ'

2013-11-23 Thread Adam D. Ruppe
On Saturday, 23 November 2013 at 23:30:09 UTC, Jeroen Bollen wrote: I added the code to my GitHub repo; there don't seem to be any uncommon associative arrays: Yea, it is the immutable string[string], I used the same pattern in my cgi.d and saw that too (sometimes, like I said, it is randomly

Re: InputRange Concatenation

2013-11-23 Thread Adam D. Ruppe
On Saturday, 23 November 2013 at 23:39:12 UTC, Nordlöw wrote: Is there a higher-order range pattern that concatenate two InputRanges? Sounds like you need std.range.chain: http://dlang.org/phobos/std_range.html#chain

InputRange Concatenation

2013-11-23 Thread Nordlöw
Is there a higher-order range pattern that concatenate two InputRanges? Something like foreach (e; a) { // do stuff with e } foreach (e; b) { // do stuff with e } ... should instead be written as foreach (e; someMagic(a, b, ...)) { // do stuff w

Re: How to make delegate refer to itself?

2013-11-23 Thread H. S. Teoh
On Sun, Nov 24, 2013 at 12:15:23AM +0100, lomereiter wrote: > Why so much fuss about delegates? I would simply define an > interface. [...] I know I can do that (and in fact it's what I had before). But classes and interfaces are rather heavy (more indirection, allocates vtables, etc.), and requi

Re: undefined reference to `_D16TypeInfo_HAyayAa6__initZ'

2013-11-23 Thread Jeroen Bollen
I added the code to my GitHub repo; there don't seem to be any uncommon associative arrays: https://github.com/SanePumpkins/FastCGI.D

Re: computing ceil at compile time

2013-11-23 Thread bearophile
bioinfornatics: $ ldc2 compute.d main.d -of ok /usr/include/d/std/math.d(2471): Error: ceill cannot be interpreted at compile time, because it has no available source code compute.d(5):called from here: ceil(cast(real)i) compute.d(8):called from here: foo(2.4F) At the moment

Re: How to make delegate refer to itself?

2013-11-23 Thread H. S. Teoh
On Sun, Nov 24, 2013 at 12:24:53AM +0100, Philippe Sigaud wrote: > On Sat, Nov 23, 2013 at 11:57 PM, H. S. Teoh wrote: > > void delegate(Event) dg = (Event e) { > > if (e == ...) > > queue.remove(dg); // NG: Still complains 'dg' isn't > > defined > >

Re: undefined reference to `_D16TypeInfo_HAyayAa6__initZ'

2013-11-23 Thread Jeroen Bollen
On Saturday, 23 November 2013 at 22:49:54 UTC, Adam D. Ruppe wrote: On Saturday, 23 November 2013 at 21:05:59 UTC, Jeroen Bollen wrote: I am getting this weird linker error when compiling my code; what does it mean? I saw this on stackoverflow first and answered there, let me link it: http:

Re: How to make delegate refer to itself?

2013-11-23 Thread Philippe Sigaud
On Sat, Nov 23, 2013 at 11:57 PM, H. S. Teoh wrote: > void delegate(Event) dg = (Event e) { > if (e == ...) > queue.remove(dg); // NG: Still complains 'dg' isn't > defined > }; > queue.register(dg); Did you try this? void delegate(Event) d

Re: undefined reference to `_D16TypeInfo_HAyayAa6__initZ'

2013-11-23 Thread Jeroen Bollen
On Saturday, 23 November 2013 at 22:34:54 UTC, bearophile wrote: Jeroen Bollen: I am getting this weird linker error when compiling my code; what does it mean? Is your code not compiling since switching to a newer compiler? What system and compilers are you using? How many modules are in yo

Re: How to make delegate refer to itself?

2013-11-23 Thread lomereiter
Why so much fuss about delegates? I would simply define an interface. // factory function for simple cases queue.register(eventHandler((Event e) { ... })); // here, 'this' is available class SomeComplicatedHandler : IEventHandler { ... }

computing ceil at compile time

2013-11-23 Thread bioinfornatics
Hi, with ldc maybe that works with an another compiler, i fail to compute std.math.ceil at compile time minimal example: http://paste.fedoraproject.org/56332/52482751 $ ldc2 compute.d main.d -of ok /usr/include/d/std/math.d(2471): Error: ceill cannot be interpreted at compile time, because i

How to make delegate refer to itself?

2013-11-23 Thread H. S. Teoh
How do I make a delegate refer to itself? I'm running into a chicken-and-egg problem where a delegate needs to remove itself from an event queue, but I don't know how to make it refer to itself: queue.register((Event e) { if (e == ...) queue.remove(

Re: undefined reference to `_D16TypeInfo_HAyayAa6__initZ'

2013-11-23 Thread Adam D. Ruppe
On Saturday, 23 November 2013 at 21:05:59 UTC, Jeroen Bollen wrote: I am getting this weird linker error when compiling my code; what does it mean? I saw this on stackoverflow first and answered there, let me link it: http://stackoverflow.com/questions/20168136/linker-error-cannot-link-d16ty

Re: OpenGL rendering issue

2013-11-23 Thread Mikko Ronkainen
Try moving glGenVertexArrays(1, &vao); glBindVertexArray(vao); at the top.

Re: undefined reference to `_D16TypeInfo_HAyayAa6__initZ'

2013-11-23 Thread bearophile
Jeroen Bollen: I am getting this weird linker error when compiling my code; what does it mean? Is your code not compiling since switching to a newer compiler? What system and compilers are you using? How many modules are in your program, and what build strategy/software are you using? Bye,

Re: D scientific graphics

2013-11-23 Thread seany
thank you, however i can use deb pckages on my distro and since in this box i already have a lot of scientific software and code interacting with each other, i want to stay to it. (chakra linux)

Re: undefined reference to `_D16TypeInfo_HAyayAa6__initZ'

2013-11-23 Thread Jeroen Bollen
On Saturday, 23 November 2013 at 21:32:13 UTC, bearophile wrote: Jeroen Bollen: I am getting this weird linker error when compiling my code; what does it mean? If your code used to work, and you have just tried dmd 2.064 then as try to compile with -allinst. Bye, bearophile No luck with

Re: undefined reference to `_D16TypeInfo_HAyayAa6__initZ'

2013-11-23 Thread bearophile
Jeroen Bollen: I am getting this weird linker error when compiling my code; what does it mean? If your code used to work, and you have just tried dmd 2.064 then as try to compile with -allinst. Bye, bearophile

undefined reference to `_D16TypeInfo_HAyayAa6__initZ'

2013-11-23 Thread Jeroen Bollen
I am getting this weird linker error when compiling my code; what does it mean?

Re: DStep

2013-11-23 Thread Jacob Carlborg
On 2013-11-22 15:35, Craig Dillabaugh wrote: I am trying to use DStep on OpenSuse 12.3. I downloaded one of the binaries (it was for Debian, so I guess that is my problem), and when I run DStep I get the following error: craigkris@linux-s9qf:~/code/DShape/D> dstep shapefil.h File(850DF8, "")/us

core.sys.posix.termios

2013-11-23 Thread Ellery Newcomer
is there any particular reason it is missing B115200 and friends?

Re: D scientific graphics

2013-11-23 Thread Jordi Sayol
El 22/11/13 17:14, Jordi Sayol ha escrit: > El 22/11/13 16:55, seany ha escrit: >> Hello, >> >> is there a D pacakge for scientific graphing, a la pyvis >> (http://pyvis.sourceforge.net/) for python? >> >> I took a look at the wiki page: >> http://wiki.dlang.org/Libraries_and_Frameworks This page

OpenGL rendering issue

2013-11-23 Thread Mineko
Not quite sure how to explain this one, all I know is that a triangle won't render and it probably has something to do with bufferdata or one of it's inputs, since this is D I had to do some roundabout things to get it work with a C library like OpenGL so.. Yeah.. https://github.com/MinekoRox

Re: Read Byte Array to Integer

2013-11-23 Thread Ali Çehreli
On 11/23/2013 08:36 AM, Jeroen Bollen wrote: > So if I have a byte array [0, 0, 1, 0], and I read a ushort from it > twice, I will get this? > > ubyte[] arr = [0, 0, 1, 0]; > arr.read!(ushort, Endian.littleEndian); // == 0 > arr.read!(ushort, Endian.littleEndian); // == 1 > arr.length; // == 0 Y

Re: Read Byte Array to Integer

2013-11-23 Thread Jeroen Bollen
On Saturday, 23 November 2013 at 15:21:02 UTC, Ali Çehreli wrote: On 11/23/2013 04:08 AM, Jeroen Bollen wrote: On Friday, 22 November 2013 at 23:12:25 UTC, Ali Çehreli wrote: That means that the slice itself cannot be modified, meaning that it cannot be consumed by read. Can't work... :) Why

Re: D game engine -- Any suggestions?

2013-11-23 Thread Rene Zwanenburg
On Friday, 22 November 2013 at 16:10:13 UTC, Mineko wrote: I did a complete restructure of the engine, so it'd be a bit better for later use. If there's anything I missed or anything I should fix, please tell me. Ignore the opengl stuff though, right now it's more or less a placeholder so I c

Re: Read Byte Array to Integer

2013-11-23 Thread Ali Çehreli
On 11/23/2013 04:08 AM, Jeroen Bollen wrote: On Friday, 22 November 2013 at 23:12:25 UTC, Ali Çehreli wrote: That means that the slice itself cannot be modified, meaning that it cannot be consumed by read. Can't work... :) Why does read need to be able to change the byte array? From the docu

Re: Read Byte Array to Integer

2013-11-23 Thread Jeroen Bollen
On Friday, 22 November 2013 at 23:12:25 UTC, Ali Çehreli wrote: That means that the slice itself cannot be modified, meaning that it cannot be consumed by read. Can't work... :) Why does read need to be able to change the byte array?

64-bit builds fails

2013-11-23 Thread evilrat
Greetings, straight to the problem - latest release(2.064.2) has a nasty bug with distribution. official installer missing Runtime.initialize() and Runtime.terminate() symbols in phobos.lib for x64 version. i tried to use rt_init() and rt_term() and at first it looks working, but then i have