Re: Embed files into binary.

2016-06-05 Thread rikki cattermole via Digitalmars-d-learn
On 06/06/2016 5:07 PM, Pie? wrote: On Monday, 6 June 2016 at 03:23:02 UTC, rikki cattermole wrote: On 06/06/2016 3:11 PM, Pie? wrote: On Monday, 6 June 2016 at 02:34:07 UTC, Adam D. Ruppe wrote: On Monday, 6 June 2016 at 02:05:09 UTC, Pie? wrote: I believe the essentially converted the file

Re: Why I can't catch the exception?

2016-06-05 Thread Piotrek via Digitalmars-d-learn
On Sunday, 5 June 2016 at 18:20:12 UTC, Era Scarecrow wrote: The assertion is being thrown in the storage.d and backtracking it basically points to line 115 (usersCollection), so am going to guess based on error messages alone that you are passing a struct/class that doesn't match inputs that

Re: Embed files into binary.

2016-06-05 Thread Pie? via Digitalmars-d-learn
On Monday, 6 June 2016 at 03:23:02 UTC, rikki cattermole wrote: On 06/06/2016 3:11 PM, Pie? wrote: On Monday, 6 June 2016 at 02:34:07 UTC, Adam D. Ruppe wrote: On Monday, 6 June 2016 at 02:05:09 UTC, Pie? wrote: I believe the essentially converted the file into a ubyte or something and then

Re: Embed files into binary.

2016-06-05 Thread Adam D. Ruppe via Digitalmars-d-learn
On Monday, 6 June 2016 at 03:11:32 UTC, Pie? wrote: e.g., how could I do this easily with your read in your png module? It takes a file.. /// Easily reads a png file into a MemoryImage MemoryImage readPng(string filename) { import std.file; return

Re: Embed files into binary.

2016-06-05 Thread rikki cattermole via Digitalmars-d-learn
On 06/06/2016 3:11 PM, Pie? wrote: On Monday, 6 June 2016 at 02:34:07 UTC, Adam D. Ruppe wrote: On Monday, 6 June 2016 at 02:05:09 UTC, Pie? wrote: I believe the essentially converted the file into a ubyte or something and then wrote that out to a temp file and read in the temp file... this

Re: Linker error

2016-06-05 Thread Anonymous via Digitalmars-d-learn
On Monday, 6 June 2016 at 02:21:03 UTC, docandrew wrote: On Sunday, 5 June 2016 at 21:26:56 UTC, Anonymous wrote: On Sunday, 5 June 2016 at 21:16:36 UTC, Andrej Mitrovic wrote: On 6/5/16, Anonymous via Digitalmars-d-learn wrote: [...] You can report it

Re: Embed files into binary.

2016-06-05 Thread Pie? via Digitalmars-d-learn
On Monday, 6 June 2016 at 02:34:07 UTC, Adam D. Ruppe wrote: On Monday, 6 June 2016 at 02:05:09 UTC, Pie? wrote: I believe the essentially converted the file into a ubyte or something and then wrote that out to a temp file and read in the temp file... this seems a bit of a kludge to me. They

Re: Embed files into binary.

2016-06-05 Thread Adam D. Ruppe via Digitalmars-d-learn
On Monday, 6 June 2016 at 02:05:09 UTC, Pie? wrote: I believe the essentially converted the file into a ubyte or something and then wrote that out to a temp file and read in the temp file... this seems a bit of a kludge to me. They might do that for certain special cases, but

Re: Embed files into binary.

2016-06-05 Thread Pie? via Digitalmars-d-learn
On Monday, 6 June 2016 at 02:18:48 UTC, docandrew wrote: On Monday, 6 June 2016 at 02:05:09 UTC, Pie? wrote: I saw somewhere someone explaining how to embed resources into a binary using the import keyword. I believe the essentially converted the file into a ubyte or something and then wrote

Re: Linker error

2016-06-05 Thread docandrew via Digitalmars-d-learn
On Sunday, 5 June 2016 at 21:26:56 UTC, Anonymous wrote: On Sunday, 5 June 2016 at 21:16:36 UTC, Andrej Mitrovic wrote: On 6/5/16, Anonymous via Digitalmars-d-learn wrote: Should I report this as a dmd bug then? Not sure where / how to do that. You can

Re: Embed files into binary.

2016-06-05 Thread docandrew via Digitalmars-d-learn
On Monday, 6 June 2016 at 02:05:09 UTC, Pie? wrote: I saw somewhere someone explaining how to embed resources into a binary using the import keyword. I believe the essentially converted the file into a ubyte or something and then wrote that out to a temp file and read in the temp file...

Embed files into binary.

2016-06-05 Thread Pie? via Digitalmars-d-learn
I saw somewhere someone explaining how to embed resources into a binary using the import keyword. I believe the essentially converted the file into a ubyte or something and then wrote that out to a temp file and read in the temp file... this seems a bit of a kludge to me. Is it possible to

Re: How to enable feedback for AssertError?

2016-06-05 Thread Ali Çehreli via Digitalmars-d-learn
On 06/05/2016 07:39 AM, your_name wrote: > The problem I have is whenever an assert in my debug build fails the > program or thread is just killed silently. That's strange. When an assertion fails, the stack trace is printed and the program is terminated. For example: void fun(int i) {

Re: Linker error

2016-06-05 Thread Anonymous via Digitalmars-d-learn
On Sunday, 5 June 2016 at 21:16:36 UTC, Andrej Mitrovic wrote: On 6/5/16, Anonymous via Digitalmars-d-learn wrote: Should I report this as a dmd bug then? Not sure where / how to do that. You can report it here: https://issues.dlang.org I think I'll just

Re: Speed up `dub`.

2016-06-05 Thread Andrej Mitrovic via Digitalmars-d-learn
On Thursday, 2 June 2016 at 13:04:00 UTC, ciechowoj wrote: and found that an assert from `std/path.d:3168` (`globMatch`) contributes a major amount to the running time of dub. ``` assert(balancedParens(pattern, '[', ']', 0)); assert(balancedParens(pattern, '{', '}', 0)); ``` Hmm..

Re: Linker error

2016-06-05 Thread Andrej Mitrovic via Digitalmars-d-learn
On 6/5/16, Anonymous via Digitalmars-d-learn wrote: > Should I report this as a dmd bug then? Not sure where / how to > do that. You can report it here: https://issues.dlang.org > I think I'll just let it go; I was able to work passed it anyway > using "static

Re: Linker error

2016-06-05 Thread Anonymous via Digitalmars-d-learn
On Sunday, 5 June 2016 at 20:16:54 UTC, Andrej Mitrovic wrote: On 6/5/16, Anonymous via Digitalmars-d-learn wrote: static Note[0] empty; Note[] getNotes(string id) { return (id in store) ? store[id] : empty; }

Re: Linker error

2016-06-05 Thread Andrej Mitrovic via Digitalmars-d-learn
On 6/5/16, Anonymous via Digitalmars-d-learn wrote: > static Note[0] empty; > > Note[] getNotes(string id) > { > return (id in store) ? store[id] : empty; > } It's likely an accepts-invalid bug, meaning it

Re: Linker error

2016-06-05 Thread Anonymous via Digitalmars-d-learn
On Sunday, 5 June 2016 at 18:45:36 UTC, docandrew wrote: On Sunday, 5 June 2016 at 18:36:13 UTC, Anonymous wrote: On Sunday, 5 June 2016 at 18:30:25 UTC, Anonymous wrote: [...] Should have included: OPTLINK (R) for Win32 Release 8.00.17 Copyright (C) Digital Mars 1989-2013 All rights

Re: Linker error

2016-06-05 Thread docandrew via Digitalmars-d-learn
On Sunday, 5 June 2016 at 18:36:13 UTC, Anonymous wrote: On Sunday, 5 June 2016 at 18:30:25 UTC, Anonymous wrote: [...] Should have included: OPTLINK (R) for Win32 Release 8.00.17 Copyright (C) Digital Mars 1989-2013 All rights reserved. http://www.digitalmars.com/ctg/optlink.html

Re: Linker error

2016-06-05 Thread Anonymous via Digitalmars-d-learn
On Sunday, 5 June 2016 at 18:30:25 UTC, Anonymous wrote: Why does the following give a linker error? If I change static Note[0] empty; to static Note[] empty;, all is well. Or if I leave it as Note[0] empty; and don't use it in getNotes, all is well. struct Note { string topic;

Linker error

2016-06-05 Thread Anonymous via Digitalmars-d-learn
Why does the following give a linker error? If I change static Note[0] empty; to static Note[] empty;, all is well. Or if I leave it as Note[0] empty; and don't use it in getNotes, all is well. struct Note { string topic; string content; } class NoteStore {

Re: Why I can't catch the exception?

2016-06-05 Thread Era Scarecrow via Digitalmars-d-learn
On Sunday, 5 June 2016 at 18:15:47 UTC, Adam D. Ruppe wrote: On Sunday, 5 June 2016 at 18:02:12 UTC, Suliman wrote: I really can't understand why try-catch block do not handle exception. digit 1 is printing, so exception is accrue after it, but why nothing in catch block?

Re: Why I can't catch the exception?

2016-06-05 Thread ag0aep6g via Digitalmars-d-learn
On 06/05/2016 08:02 PM, Suliman wrote: I really can't understand why try-catch block do not handle exception. digit 1 is printing, so exception is accrue after it, but why nothing in catch block? http://img.ctrlv.in/img/16/06/05/57546861d8e81.png Here is my code: void dbSetup() { try

Re: Why I can't catch the exception?

2016-06-05 Thread Adam D. Ruppe via Digitalmars-d-learn
On Sunday, 5 June 2016 at 18:02:12 UTC, Suliman wrote: I really can't understand why try-catch block do not handle exception. digit 1 is printing, so exception is accrue after it, but why nothing in catch block? http://img.ctrlv.in/img/16/06/05/57546861d8e81.png catch(Exception e)

Why I can't catch the exception?

2016-06-05 Thread Suliman via Digitalmars-d-learn
I really can't understand why try-catch block do not handle exception. digit 1 is printing, so exception is accrue after it, but why nothing in catch block? http://img.ctrlv.in/img/16/06/05/57546861d8e81.png Here is my code: void dbSetup() { try { //getcwd do not return

How to enable feedback for AssertError?

2016-06-05 Thread your_name via Digitalmars-d-learn
Hello, thanks for reading this. The problem I have is whenever an assert in my debug build fails the program or thread is just killed silently. How can I change this behavior to something akin to SIGSEGV ? Thanks!

Re: throw Exception with custom message in nogc code

2016-06-05 Thread HubCool via Digitalmars-d-learn
On Sunday, 5 June 2016 at 10:37:49 UTC, poliklosio wrote: On Sunday, 5 June 2016 at 06:25:28 UTC, HubCool wrote: Can you elaborate on how to dispose the exception? I'm partilularly interested in the code you would write in place of the /*can dispose here too...*/ comment. I don't know from

Re: throw Exception with custom message in nogc code

2016-06-05 Thread poliklosio via Digitalmars-d-learn
On Sunday, 5 June 2016 at 10:37:49 UTC, poliklosio wrote: Also, exceptions are not necessarily for bugs. There may be used sometimes for bug handling when other things like static typing and assertions are not enough, but bug handling is not the core reason for havi ng exceptions in languages.

Re: throw Exception with custom message in nogc code

2016-06-05 Thread poliklosio via Digitalmars-d-learn
On Sunday, 5 June 2016 at 06:25:28 UTC, HubCool wrote: (...) But I'd say that the leak doesn't matter. Either the soft has a very small problem that happens once eventually, otherwise it's a big bug and new exceptions will come so often that the program has to be killed immediatly.

Re: Speed up `dub`.

2016-06-05 Thread Jacob Carlborg via Digitalmars-d-learn
On 04/06/16 10:04, Russel Winder via Digitalmars-d-learn wrote: Dub must check all dependencies before starting a build, the question is whether is should download and build them or just fail. Yeah, I meant check online. -- /Jacob Carlborg

Re: Object.factory fails for static libraries

2016-06-05 Thread Andre Pany via Digitalmars-d-learn
On Sunday, 5 June 2016 at 08:40:18 UTC, Andre Pany wrote: On Saturday, 4 June 2016 at 16:12:04 UTC, Andre Pany wrote: Hi, I try to create objects by using the factory method in a static library scenario. ... I just validated, the same issue also occurs on ubuntu linux with the recent dmd

Re: Object.factory fails for static libraries

2016-06-05 Thread Andre Pany via Digitalmars-d-learn
On Saturday, 4 June 2016 at 16:12:04 UTC, Andre Pany wrote: Hi, I try to create objects by using the factory method in a static library scenario. ... My windows batch file looks like this: dmd base -lib dmd child -lib base.lib dmd main base.lib child.lib main PAUSE All assertions fails.

Re: throw Exception with custom message in nogc code

2016-06-05 Thread HubCool via Digitalmars-d-learn
On Sunday, 5 June 2016 at 00:05:15 UTC, poliklosio wrote: I need to throw some exceptions in my code, but I don't want to ever care about the garbage collector. I have seen some solutions to throwing exceptions in nogc code, but only toy examples, like