How to force an array literal into a read-only data segment?

2019-09-12 Thread Max Samukha via Digitalmars-d-learn
test.d: __gshared t = "text".ptr; As expected, the "text" literal ends up in a read-only data segment, with a pointer to it stored in a writable data segment (_TMP0 pointing into .rodata.str1.1): .data segment _D4test1tPya: dd offset FLAT:_TMP0@64 db

Limitation in number of symbols in a single compilation unit

2019-09-12 Thread Per Nordlöw via Digitalmars-d-learn
Is there still a limitation in the number of symbols DMD/LDC can handle for a single compilation unit? Is this limitation target specific and related to a specific linker?

Re: How to force an array literal into a read-only data segment?

2019-09-12 Thread a11e99z via Digitalmars-d-learn
On Thursday, 12 September 2019 at 07:04:19 UTC, Max Samukha wrote: How to achieve the same for an array literal? The closest I could come: enum immutable(int[3]) _tmp = [1, 2, 3]; __gshared a = _tmp.ptr; Is it possible to force the array into rodata?

Re: Using CSS Data from Within My Code

2019-09-12 Thread Max Samukha via Digitalmars-d-learn
On Thursday, 12 September 2019 at 09:54:35 UTC, Ron Tarrant wrote: I found this presented as a solution in a 2016 post: On Wednesday, 15 June 2016 at 22:05:37 UTC, captaindet wrote: enum myCSS = q{ GtkNotebook { background-color: #e9e9e9; } GtkNotebook tab {

Re: How to force an array literal into a read-only data segment?

2019-09-12 Thread Max Samukha via Digitalmars-d-learn
On Thursday, 12 September 2019 at 08:54:09 UTC, a11e99z wrote: On Thursday, 12 September 2019 at 07:04:19 UTC, Max Samukha wrote: How to achieve the same for an array literal? The closest I could come: enum immutable(int[3]) _tmp = [1, 2, 3]; __gshared a = _tmp.ptr; Is it possible to force

Using CSS Data from Within My Code

2019-09-12 Thread Ron Tarrant via Digitalmars-d-learn
I found this presented as a solution in a 2016 post: On Wednesday, 15 June 2016 at 22:05:37 UTC, captaindet wrote: enum myCSS = q{ GtkNotebook { background-color: #e9e9e9; } GtkNotebook tab { background-color: #d6d6d6; } }; But when I try to use it, I get the

Re: Using CSS Data from Within My Code

2019-09-12 Thread Ron Tarrant via Digitalmars-d-learn
On Thursday, 12 September 2019 at 10:09:06 UTC, Andrea Fontana wrote: On Thursday, 12 September 2019 at 09:54:35 UTC, Ron Tarrant wrote: I found this presented as a solution in a 2016 post: On Wednesday, 15 June 2016 at 22:05:37 UTC, captaindet wrote: enum myCSS = q{ GtkNotebook {

Re: problems with swig generated code

2019-09-12 Thread Ernesto Castellotti via Digitalmars-d-learn
On Tuesday, 3 September 2019 at 20:03:37 UTC, Martin DeMello wrote: On Sunday, 1 September 2019 at 11:19:11 UTC, DanielG wrote: Do you know whether SWIG's D generator is even being maintained? I've searched for it on the forums in the past and got the impression that it's outdated. I

Re: Using CSS Data from Within My Code

2019-09-12 Thread Andrea Fontana via Digitalmars-d-learn
On Thursday, 12 September 2019 at 09:54:35 UTC, Ron Tarrant wrote: I found this presented as a solution in a 2016 post: On Wednesday, 15 June 2016 at 22:05:37 UTC, captaindet wrote: enum myCSS = q{ GtkNotebook { background-color: #e9e9e9; } GtkNotebook tab {

Re: Using CSS Data from Within My Code

2019-09-12 Thread Ron Tarrant via Digitalmars-d-learn
On Thursday, 12 September 2019 at 11:35:04 UTC, Ron Tarrant wrote: On Thursday, 12 September 2019 at 10:09:06 UTC, Andrea Fontana wrote: On Thursday, 12 September 2019 at 09:54:35 UTC, Ron Tarrant wrote: I found this presented as a solution in a 2016 post: On Wednesday, 15 June 2016 at

Make executable archive just like Java's .jar archive?

2019-09-12 Thread BoQsc via Digitalmars-d-learn
Is there a way to archive multiple .d source code files and make that archive executable, or something similar?

Re: Make executable archive just like Java's .jar archive?

2019-09-12 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 12 September 2019 at 12:53:27 UTC, BoQsc wrote: On Thursday, 12 September 2019 at 12:52:48 UTC, BoQsc wrote: Is there a way to archive multiple .d source code files and make that archive executable, or something similar? https://en.wikipedia.org/wiki/JAR_(file_format) A JAR

Re: Make executable archive just like Java's .jar archive?

2019-09-12 Thread BoQsc via Digitalmars-d-learn
On Thursday, 12 September 2019 at 12:52:48 UTC, BoQsc wrote: Is there a way to archive multiple .d source code files and make that archive executable, or something similar? https://en.wikipedia.org/wiki/JAR_(file_format)

Re: Using CSS Data from Within My Code

2019-09-12 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 12 September 2019 at 11:40:33 UTC, Ron Tarrant wrote: string myCSS = "tab { background-color: #f2f2f2; }"; enum will work just as well here and without the need for the variable: enum myCSS = "tab { background-color: #f2f2f2; }"; The original error was

Re: Using CSS Data from Within My Code

2019-09-12 Thread Ron Tarrant via Digitalmars-d-learn
On Thursday, 12 September 2019 at 13:09:16 UTC, Mike Parker wrote: On Thursday, 12 September 2019 at 11:40:33 UTC, Ron Tarrant wrote: string myCSS = "tab { background-color: #f2f2f2; }"; enum will work just as well here and without the need for the variable: enum myCSS

Re: Using CSS Data from Within My Code

2019-09-12 Thread Ali Çehreli via Digitalmars-d-learn
On 09/12/2019 02:54 AM, Ron Tarrant wrote: > I thought it was odd having 'q' in front of the opening curly brace... I think my index can be useful in such searches. Both q"" and q{} are there: http://ddili.org/ders/d.en/ix.html Ali

Re: Make executable archive just like Java's .jar archive?

2019-09-12 Thread norm via Digitalmars-d-learn
On Thursday, 12 September 2019 at 12:52:48 UTC, BoQsc wrote: Is there a way to archive multiple .d source code files and make that archive executable, or something similar? You can achieve something similar with rdmd and shell; $ tar -zcvf source_files.tar.gz source1.d source2.d ... sourceN.d

Re: What is "dual-context" ?

2019-09-12 Thread Paul Backus via Digitalmars-d-learn
On Friday, 13 September 2019 at 02:49:33 UTC, SrMordred wrote: source\app.d(37,10): Error: function `app.main.match!((some) => print(some), (none) => print("none")).match` requires a dual-context, which is not yet supported by LDC I was playing with my home made "sumtypes". The code below

What is "dual-context" ?

2019-09-12 Thread SrMordred via Digitalmars-d-learn
source\app.d(37,10): Error: function `app.main.match!((some) => print(some), (none) => print("none")).match` requires a dual-context, which is not yet supported by LDC I was playing with my home made "sumtypes". The code below works fine in dmd, but in ldc it triggers that error.

Name change weird

2019-09-12 Thread Joel via Digitalmars-d-learn
I edited one of my librarys and found my programs crashing. At first, I couldn't find what was wrong but used GitHub to review my changes. I found an enum[0] that had a name change - that my programs weren't even using. All the change that was from 'enum g_Draw {text, input}' to 'enum g_draw