Re: Problem using shared D library from C shared library

2016-04-06 Thread rikki cattermole via Digitalmars-d-learn
On 07/04/2016 5:23 PM, Yuxuan Shui wrote: On Thursday, 7 April 2016 at 04:36:02 UTC, Yuxuan Shui wrote: On Thursday, 7 April 2016 at 04:24:48 UTC, Yuxuan Shui wrote: [...] Looks like _d_arrayappendcTX asked for a enormous amount of memory and it fails, can't figure out why Just find out

Re: Problem using shared D library from C shared library

2016-04-06 Thread jkpl via Digitalmars-d-learn
On Thursday, 7 April 2016 at 05:23:47 UTC, Yuxuan Shui wrote: On Thursday, 7 April 2016 at 04:36:02 UTC, Yuxuan Shui wrote: On Thursday, 7 April 2016 at 04:24:48 UTC, Yuxuan Shui wrote: [...] Looks like _d_arrayappendcTX asked for a enormous amount of memory and it fails, can't figure out

Re: Problem using shared D library from C shared library

2016-04-06 Thread Yuxuan Shui via Digitalmars-d-learn
On Thursday, 7 April 2016 at 04:36:02 UTC, Yuxuan Shui wrote: On Thursday, 7 April 2016 at 04:24:48 UTC, Yuxuan Shui wrote: [...] Looks like _d_arrayappendcTX asked for a enormous amount of memory and it fails, can't figure out why Just find out it's my own fault. BTW, memory block

Re: Problem using shared D library from C shared library

2016-04-06 Thread Yuxuan Shui via Digitalmars-d-learn
On Thursday, 7 April 2016 at 04:24:48 UTC, Yuxuan Shui wrote: On Thursday, 7 April 2016 at 03:37:39 UTC, Yuxuan Shui wrote: On Thursday, 7 April 2016 at 03:19:58 UTC, rikki cattermole wrote: On 07/04/2016 3:18 PM, Yuxuan Shui wrote: On Thursday, 7 April 2016 at 02:01:31 UTC, Mike Parker

Re: Problem using shared D library from C shared library

2016-04-06 Thread Yuxuan Shui via Digitalmars-d-learn
On Thursday, 7 April 2016 at 03:37:39 UTC, Yuxuan Shui wrote: On Thursday, 7 April 2016 at 03:19:58 UTC, rikki cattermole wrote: On 07/04/2016 3:18 PM, Yuxuan Shui wrote: On Thursday, 7 April 2016 at 02:01:31 UTC, Mike Parker wrote: [...] static this/static ~this should work, right? They

Re: Problem using shared D library from C shared library

2016-04-06 Thread Yuxuan Shui via Digitalmars-d-learn
On Thursday, 7 April 2016 at 03:19:58 UTC, rikki cattermole wrote: On 07/04/2016 3:18 PM, Yuxuan Shui wrote: On Thursday, 7 April 2016 at 02:01:31 UTC, Mike Parker wrote: [...] static this/static ~this should work, right? They execute when the runtime is started. So now I add call

Re: Problem using shared D library from C shared library

2016-04-06 Thread rikki cattermole via Digitalmars-d-learn
On 07/04/2016 3:18 PM, Yuxuan Shui wrote: On Thursday, 7 April 2016 at 02:01:31 UTC, Mike Parker wrote: On Thursday, 7 April 2016 at 01:50:31 UTC, Yuxuan Shui wrote: [...] The runtime is needed if you are going to use any of its features, like the GC. If you restrict yourself strictly to C

Re: Problem using shared D library from C shared library

2016-04-06 Thread Yuxuan Shui via Digitalmars-d-learn
On Thursday, 7 April 2016 at 02:01:31 UTC, Mike Parker wrote: On Thursday, 7 April 2016 at 01:50:31 UTC, Yuxuan Shui wrote: [...] The runtime is needed if you are going to use any of its features, like the GC. If you restrict yourself strictly to C in D (and that means avoiding thinks like

Re: Problem using shared D library from C shared library

2016-04-06 Thread Yuxuan Shui via Digitalmars-d-learn
On Thursday, 7 April 2016 at 02:01:31 UTC, Mike Parker wrote: On Thursday, 7 April 2016 at 01:50:31 UTC, Yuxuan Shui wrote: [...] The runtime is needed if you are going to use any of its features, like the GC. If you restrict yourself strictly to C in D (and that means avoiding thinks like

Re: Build release and debug with dub

2016-04-06 Thread Puming via Digitalmars-d-learn
On Thursday, 7 April 2016 at 02:07:18 UTC, Puming wrote: On Wednesday, 6 April 2016 at 19:49:38 UTC, Suliman wrote: [...] In the document it says you can not specify targetName in buildType. I wonder why is that? But you can use two configurations like this(assumming your project is named

Re: Build release and debug with dub

2016-04-06 Thread Puming via Digitalmars-d-learn
On Wednesday, 6 April 2016 at 19:49:38 UTC, Suliman wrote: Is it's possible to make rule, that allow to build two version of App? One release and one debug at same time. I looked at "buildTypes" https://code.dlang.org/package-format?lang=json But it's not possible to set different names for

Re: Problem using shared D library from C shared library

2016-04-06 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 7 April 2016 at 01:50:31 UTC, Yuxuan Shui wrote: On Thursday, 7 April 2016 at 01:42:54 UTC, rikki cattermole wrote: On 07/04/2016 1:38 PM, Yuxuan Shui wrote: [...] Have you started D's runtime? How to start D's runtime? I followed the examples found here:

Re: Problem using shared D library from C shared library

2016-04-06 Thread Yuxuan Shui via Digitalmars-d-learn
On Thursday, 7 April 2016 at 01:42:54 UTC, rikki cattermole wrote: On 07/04/2016 1:38 PM, Yuxuan Shui wrote: [...] Have you started D's runtime? How to start D's runtime? I followed the examples found here: https://dlang.org/dll-linux.html#dso9, which doesn't say anything about starting

Re: Putting things in an enum's scope

2016-04-06 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 6 April 2016 at 13:59:42 UTC, pineapple wrote: Is there any way in D to define static methods or members within an enum's scope, as one might do in Java? It can sometimes help with code organization. For example, this is something that coming from Java I'd have expected to be

Re: Problem using shared D library from C shared library

2016-04-06 Thread rikki cattermole via Digitalmars-d-learn
On 07/04/2016 1:38 PM, Yuxuan Shui wrote: I have a D shared library which is loaded by a C shared library, which is in turn loaded by my main program. When the D library tries to allocate something, the whole program get an SIGSEGV in __GI___pthread_mutex_lock. Stack trace: (gdb) bt #0

Problem using shared D library from C shared library

2016-04-06 Thread Yuxuan Shui via Digitalmars-d-learn
I have a D shared library which is loaded by a C shared library, which is in turn loaded by my main program. When the D library tries to allocate something, the whole program get an SIGSEGV in __GI___pthread_mutex_lock. Stack trace: (gdb) bt #0 __GI___pthread_mutex_lock

Re: Best properly way to destroy a 2 dimensional array?

2016-04-06 Thread Alex Parrill via Digitalmars-d-learn
On Wednesday, 6 April 2016 at 23:14:10 UTC, Jonathan Villa wrote: On Wednesday, 6 April 2016 at 21:33:14 UTC, Alex Parrill wrote: My general idea is first to get the predicted quantity of combinations Seems like you already know; your OP says you have 2^n combinations. so I can divide

Re: Best properly way to destroy a 2 dimensional array?

2016-04-06 Thread Jonathan Villa via Digitalmars-d-learn
On Wednesday, 6 April 2016 at 21:33:14 UTC, Alex Parrill wrote: On Wednesday, 6 April 2016 at 19:54:32 UTC, Jonathan Villa wrote: I wrote a little program that given some number it generates a ... Why not make a range instead? No need to reserve memory for the entire array if you can compute

Re: Putting things in an enum's scope

2016-04-06 Thread Alex Parrill via Digitalmars-d-learn
On Wednesday, 6 April 2016 at 13:59:42 UTC, pineapple wrote: Is there any way in D to define static methods or members within an enum's scope, as one might do in Java? It can sometimes help with code organization. For example, this is something that coming from Java I'd have expected to be

Re: Best properly way to destroy a 2 dimensional array?

2016-04-06 Thread Alex Parrill via Digitalmars-d-learn
On Wednesday, 6 April 2016 at 19:54:32 UTC, Jonathan Villa wrote: I wrote a little program that given some number it generates a list of different combinations (represented by a ubyte array), so in the end my function with name GenerateCombinations(int x) returns a ubyte[][] (list of arrays of

Re: Best properly way to destroy a 2 dimensional array?

2016-04-06 Thread Jonathan Villa via Digitalmars-d-learn
On Wednesday, 6 April 2016 at 19:54:32 UTC, Jonathan Villa wrote: I wrote a little program that given some number it generates a TL;DR: My program generates a very large `ubyte[][]`, and after I call destroy and GC.collect() and GC.minimize(), the memory occuping doesn't seems to decrease.

Re: Best properly way to destroy a 2 dimensional array?

2016-04-06 Thread Jonathan Villa via Digitalmars-d-learn
On Wednesday, 6 April 2016 at 19:54:32 UTC, Jonathan Villa wrote: I wrote a little program that given some number it generates a list of different combinations (represented by a ubyte array), so in the end my function with name GenerateCombinations(int x) returns a ubyte[][] (list of arrays of

Re: Issue with 2.071: Regression or valid error?

2016-04-06 Thread Andre via Digitalmars-d-learn
On Wednesday, 6 April 2016 at 19:22:44 UTC, Daniel Kozak wrote: This should not compile. Cat cant access create because it is private. Ok it can access it but only if you move cat into same module as animal Dne 6. 4. 2016 17:16 napsal uživatel "Andre via Digitalmars-d-learn" <

Best properly way to destroy a 2 dimensional array?

2016-04-06 Thread Jonathan Villa via Digitalmars-d-learn
I wrote a little program that given some number it generates a list of different combinations (represented by a ubyte array), so in the end my function with name GenerateCombinations(int x) returns a ubyte[][] (list of arrays of ubytes). Now the problem is, the quantity of combinations

Build release and debug with dub

2016-04-06 Thread Suliman via Digitalmars-d-learn
Is it's possible to make rule, that allow to build two version of App? One release and one debug at same time. I looked at "buildTypes" https://code.dlang.org/package-format?lang=json But it's not possible to set different names for output files. I want to build App.exe and AppDebug.exe after

Re: Issue with 2.071: Regression or valid error?

2016-04-06 Thread Daniel Kozak via Digitalmars-d-learn
This should not compile. Cat cant access create because it is private. Ok it can access it but only if you move cat into same module as animal Dne 6. 4. 2016 17:16 napsal uživatel "Andre via Digitalmars-d-learn" < digitalmars-d-learn@puremagic.com>: > Hi, > > With 2.071 following coding does not

Re: Issue with 2.071: Regression or valid error?

2016-04-06 Thread Craig Dillabaugh via Digitalmars-d-learn
On Wednesday, 6 April 2016 at 19:01:58 UTC, Craig Dillabaugh wrote: On Wednesday, 6 April 2016 at 15:10:45 UTC, Andre wrote: clip Not so up to date on D's OOP stuff, but don't you want create() to be protected, not private. You can typically access a private method through a base class,

Re: Issue with 2.071: Regression or valid error?

2016-04-06 Thread Craig Dillabaugh via Digitalmars-d-learn
On Wednesday, 6 April 2016 at 15:10:45 UTC, Andre wrote: Hi, With 2.071 following coding does not compile anymore and somehow I feel it should compile. The issue is with line "cat.create();". Cat is a sub type of Animal. Animal "owns" method create and I want to call the method create

Issue with 2.071: Regression or valid error?

2016-04-06 Thread Andre via Digitalmars-d-learn
Hi, With 2.071 following coding does not compile anymore and somehow I feel it should compile. The issue is with line "cat.create();". Cat is a sub type of Animal. Animal "owns" method create and I want to call the method create within the class Animal for cat. Is the error message "no

Re: Putting things in an enum's scope

2016-04-06 Thread Adam D. Ruppe via Digitalmars-d-learn
On Wednesday, 6 April 2016 at 13:59:42 UTC, pineapple wrote: Is there any way in D to define static methods or members within an enum's scope, as one might do in Java? No. You could make a struct rather than an enum though with the methods, and a bunch of static things to simulate

Putting things in an enum's scope

2016-04-06 Thread pineapple via Digitalmars-d-learn
Is there any way in D to define static methods or members within an enum's scope, as one might do in Java? It can sometimes help with code organization. For example, this is something that coming from Java I'd have expected to be valid but isn't: enum SomeEnum{ NORTH, SOUTH, EAST, WEST;

Re: What's the rationale for considering "0x1.max" as invalid ?

2016-04-06 Thread Alex Parrill via Digitalmars-d-learn
On Tuesday, 5 April 2016 at 21:40:59 UTC, Basile B. wrote: On Tuesday, 5 April 2016 at 21:10:47 UTC, Basile B. wrote: On Tuesday, 5 April 2016 at 20:56:54 UTC, Alex Parrill wrote: On Tuesday, 5 April 2016 at 19:00:43 UTC, Basile B. wrote: 0x1.max // exponent expected in hex float 0x1 .max //

Re: What is the best way to store bitarray (blob) for pasting in database?

2016-04-06 Thread Alex Parrill via Digitalmars-d-learn
On Wednesday, 6 April 2016 at 12:56:39 UTC, Suliman wrote: I have next task. There is PostgreSQL DB. With field like: id, mydata. mydata - is binary blob. It can be 10MB or even more. I need load all data from PostgreSQL to SQLLite. I decided ti create struct that and fill it with data. And

What is the best way to store bitarray (blob) for pasting in database?

2016-04-06 Thread Suliman via Digitalmars-d-learn
I have next task. There is PostgreSQL DB. With field like: id, mydata. mydata - is binary blob. It can be 10MB or even more. I need load all data from PostgreSQL to SQLLite. I decided ti create struct that and fill it with data. And then do INSERT operation in sqllite. But I do not know is