Re: C.h to D conversion (structs)

2016-03-15 Thread Chris via Digitalmars-d-learn
On Tuesday, 15 March 2016 at 18:47:22 UTC, Adam D. Ruppe wrote: Like you would another D library. Now I get it! Yes, that works as expected. The problem isn't the struct itself, but the D initializer. Structs in C don't have initalizers but do in D: struct Foo { int a = 10; /*

Re: Clearing associative array.

2016-03-15 Thread Steven Schveighoffer via Digitalmars-d-learn
On 3/12/16 8:09 AM, Adam D. Ruppe wrote: On Saturday, 12 March 2016 at 12:59:02 UTC, ciechowoj wrote: Nice article :), thanks. But still, what about clear()? In the documentation https://dlang.org/spec/hash-map.html#properties there is written that associative arrays have clear property. I

Re: Is there a sorted map?

2016-03-15 Thread Steven Schveighoffer via Digitalmars-d-learn
On 3/13/16 4:33 AM, Jonathan M Davis via Digitalmars-d-learn wrote: On Sunday, March 13, 2016 02:35:27 stunaep via Digitalmars-d-learn wrote: Is there any sorted map in D? I need a map and I need to be able to get the highest key in the map. In java I would use a TreeMap and use map.lastKey(),

Re: C.h to D conversion (structs)

2016-03-15 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 15 March 2016 at 18:04:00 UTC, Chris wrote: I'm not 100% sure what you mean with compile+link in the modules. Like you would another D library. The structs are all defined in the original (third party) C header file. It's nothing I added (in which case I would have to recompile

Re: Gdmd compiling error

2016-03-15 Thread Ali Çehreli via Digitalmars-d-learn
On 03/15/2016 02:45 AM, Orkhan wrote: > output of the gdc is : > > root@ubuntu:/home/alikoza/Downloads/i686-pc-linux-gnu# gdc > gdc: fatal error: no input files > compilation terminated. That makes sense. It should produce an executable if you give it a .d file: gdc foo.d Since you

Re: Is there anybody who used FireBird DB?

2016-03-15 Thread Ali Çehreli via Digitalmars-d-learn
On 03/15/2016 07:08 AM, Suliman wrote: For my regret I need way to work with FireBird. I have found only one driver for D https://github.com/jiorhub/fired Before I did not work with C-bindigs and D. So I can't understand how to use this files. Could anybody help and explain how to work with

Re: C.h to D conversion (structs)

2016-03-15 Thread Chris via Digitalmars-d-learn
On Tuesday, 15 March 2016 at 17:10:03 UTC, Adam D. Ruppe wrote: On Tuesday, 15 March 2016 at 16:56:00 UTC, Chris wrote: Do you mean I need to void initialize them in the C code or in D? And if in D, how would I do that, with `static this`? in D, at the usage point with =void where you declare

Re: Tracing InvalidMemoryOperationError

2016-03-15 Thread Ali Çehreli via Digitalmars-d-learn
On 03/15/2016 12:27 AM, stunaep wrote: > I need to find the source of this InvalidMemoryOperationError. I tried > loading the project in visuald but it wont break on the error. Just to make sure, you tried to break inside the constructor of InvalidMemoryOperationError, right? Right where it

Re: How to list all version identifiers?

2016-03-15 Thread Timothee Cour via Digitalmars-d-learn
would be easy with compiler as a library... also i thought 'dmd -v -version=foo -c -o- bar.d' would show -version identifiers used on the command line but doesn't seem to On Tue, Mar 15, 2016 at 8:51 AM, Iakh via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote: > On Sunday, 13

Re: Is there anybody who used FireBird DB?

2016-03-15 Thread Suliman via Digitalmars-d-learn
On Tuesday, 15 March 2016 at 15:01:09 UTC, Kagamin wrote: The same as you would do it in C. I do not know C :( Please explain me what i should to do with this binding

Re: C.h to D conversion (structs)

2016-03-15 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 15 March 2016 at 16:56:00 UTC, Chris wrote: Do you mean I need to void initialize them in the C code or in D? And if in D, how would I do that, with `static this`? in D, at the usage point with =void where you declare the variable of that type. So in your code: struct C { A a

Re: C.h to D conversion (structs)

2016-03-15 Thread Chris via Digitalmars-d-learn
On Tuesday, 15 March 2016 at 16:44:10 UTC, Adam D. Ruppe wrote: On Tuesday, 15 March 2016 at 16:32:56 UTC, Chris wrote: The error I get is something like undefined reference to `_D3test7testmodule13A6__initZ' undefined reference to `_D3test7testmodule13B6__initZ' You still need to

Re: C.h to D conversion (structs)

2016-03-15 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 15 March 2016 at 16:32:56 UTC, Chris wrote: The error I get is something like undefined reference to `_D3test7testmodule13A6__initZ' undefined reference to `_D3test7testmodule13B6__initZ' You still need to compile/link in the module (or in this specific case, void initialize the

C.h to D conversion (structs)

2016-03-15 Thread Chris via Digitalmars-d-learn
I've converted a C.h file to D according to this guide: http://wiki.dlang.org/Converting_C_.h_Files_to_D_Modules and examples in deimos: https://github.com/D-Programming-Deimos/ However, I get an error when trying to use a struct that uses structs. struct A { size_t i; } struct B {

Re: How to list all version identifiers?

2016-03-15 Thread Iakh via Digitalmars-d-learn
On Sunday, 13 March 2016 at 20:16:36 UTC, Basile B. wrote: On Sunday, 13 March 2016 at 16:28:50 UTC, Iakh wrote: On Sunday, 13 March 2016 at 15:50:47 UTC, Basile B. wrote: trivial answer, let's say you have dcd-server running in the background: dcd-client -c8 <<< "version(" Thanks. Will

Re: Not sure how to translate this C++ variable to D.

2016-03-15 Thread Ali Çehreli via Digitalmars-d-learn
On 03/15/2016 07:29 AM, WhatMeWorry wrote: >> SpriteRenderer Renderer; // Although, I would name it 'renderer' > Ok. I was trying something more D like, by doing: > > SpriteRenderer Renderer = new SpriteRenderer(); That would work if the variable were const or immutable and if everything

Re: Is there anybody who used FireBird DB?

2016-03-15 Thread Kagamin via Digitalmars-d-learn
The same as you would do it in C.

Re: Not sure how to translate this C++ variable to D.

2016-03-15 Thread WhatMeWorry via Digitalmars-d-learn
On Monday, 14 March 2016 at 22:19:50 UTC, Ali Çehreli wrote: On 03/14/2016 03:14 PM, WhatMeWorry wrote: > > sprite_renderer.h -- > > class SpriteRenderer > { > ... > }; Same thing in D without the semicolon. :) > game.cpp

Is there anybody who used FireBird DB?

2016-03-15 Thread Suliman via Digitalmars-d-learn
For my regret I need way to work with FireBird. I have found only one driver for D https://github.com/jiorhub/fired Before I did not work with C-bindigs and D. So I can't understand how to use this files. Could anybody help and explain how to work with it?

Re: Is D a good choice for embedding python/octave/julia

2016-03-15 Thread John Colvin via Digitalmars-d-learn
On Sunday, 13 March 2016 at 13:02:16 UTC, Bastien wrote: Hi, apologies for what may be a fairly obvious question to some. ## The background: I have been tasked with building software to process data output by scientific instruments for non-experts - basically with GUI, menus, easy config

Re: Using tango or other static lib in static lib

2016-03-15 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 15 March 2016 at 08:40:31 UTC, Jaocb Carlborg wrote: On Tuesday, 15 March 2016 at 06:54:45 UTC, Zardoz wrote: Not would be more easy to simply add a dependency to tango on dub.SDL ? I ask... Yes. Mike gave a very long explanation that can be summed up by saying: add Tango as a

Re: Gdmd compiling error

2016-03-15 Thread Orkhan via Digitalmars-d-learn
On Monday, 14 March 2016 at 17:08:24 UTC, Marc Schütz wrote: On Monday, 14 March 2016 at 14:46:06 UTC, Orkhan wrote: [...] What does `which gdc` print? If it says something like "which: no gdc in ...", there is a problem with the installation of GDC. Otherwise, you can use the following as

Re: Gdmd compiling error

2016-03-15 Thread Orkhan via Digitalmars-d-learn
On Monday, 14 March 2016 at 18:13:33 UTC, Ali Çehreli wrote: On 03/14/2016 10:08 AM, Marc Schütz wrote: > What does `which gdc` print? If it says something like "which: no gdc in > ...", there is a problem with the installation of GDC. Otherwise, you > can use the following as a quick

Re: Gdmd compiling error

2016-03-15 Thread Orkhan via Digitalmars-d-learn
On Monday, 14 March 2016 at 17:08:24 UTC, Marc Schütz wrote: On Monday, 14 March 2016 at 14:46:06 UTC, Orkhan wrote: On Monday, 14 March 2016 at 11:11:28 UTC, Ali Çehreli wrote: On 03/14/2016 02:56 AM, Orkhan wrote: > THe output like that : > root@ubuntu:/opt/xcomm# gdmd > Can't exec

Re: Is D a good choice for embedding python/octave/julia

2016-03-15 Thread Laeeth Isharc via Digitalmars-d-learn
On Tuesday, 15 March 2016 at 05:56:36 UTC, Ellery Newcomer wrote: On 03/13/2016 02:36 PM, Laeeth Isharc wrote: InterpContext context = new InterpContext(); context.py_stmts(outdent(" import numpy a = numpy.eye(2, dtype='complex128') "));

Re: Using tango or other static lib in static lib

2016-03-15 Thread Jaocb Carlborg via Digitalmars-d-learn
On Tuesday, 15 March 2016 at 06:54:45 UTC, Zardoz wrote: Not would be more easy to simply add a dependency to tango on dub.SDL ? I ask... Yes. Mike gave a very long explanation that can be summed up by saying: add Tango as a dependency to your dub.json/sdl. -- /Jacob Carlborg

Tracing InvalidMemoryOperationError

2016-03-15 Thread stunaep via Digitalmars-d-learn
I need to find the source of this InvalidMemoryOperationError. I tried loading the project in visuald but it wont break on the error. I also tried adding extern(C) void onInvalidMemoryOperationError(void*) { asm { int 3; } } building with dub build --build=debug --arch=x86_64 and then

Re: Using tango or other static lib in static lib

2016-03-15 Thread Zardoz via Digitalmars-d-learn
On Sunday, 13 March 2016 at 01:08:29 UTC, Mike Parker wrote: On Sunday, 13 March 2016 at 01:06:33 UTC, Mike Parker wrote: it. Assuming both files live in the same directory, they can be compiled with this command: Somehow I deleted that line: dmd main.d something.d Not would be more easy

Re: Is D a good choice for embedding python/octave/julia

2016-03-15 Thread Ellery Newcomer via Digitalmars-d-learn
On 03/13/2016 02:36 PM, Laeeth Isharc wrote: InterpContext context = new InterpContext(); context.py_stmts(outdent(" import numpy a = numpy.eye(2, dtype='complex128') ")); context.a.to_d!(Complex!double[][] )(); nitpicking, but the outdent is unnecessary,