Re: how to benchmark pure functions?

2022-10-28 Thread Siarhei Siamashka via Digitalmars-d-learn
On Friday, 28 October 2022 at 09:48:14 UTC, ab wrote: Thanks to H.S. Teoh and Dennis for the suggestions, they both work. I like the empty asm block a bit more because it is less invasive, but it only works with ldc. I used the volatileLoad/volatileStore functions to ensure that the compiler

Re: Importing modules under DUB on Windows

2022-10-28 Thread DLearner via Digitalmars-d-learn
On Friday, 28 October 2022 at 21:32:46 UTC, rikki cattermole wrote: On 29/10/2022 4:15 AM, DLearner wrote: However, going forward, I don't want copies of OM anywhere other than UD. If you want your own private library on your system (that will get used a lot), you can create a package and use

Re: Replacing tango.text.Ascii.isearch

2022-10-28 Thread rikki cattermole via Digitalmars-d-learn
On 29/10/2022 11:05 AM, Siarhei Siamashka wrote: And as for the D language and Phobos, should "ß" still uppercase to "SS"? Or can we change it to uppercase "ẞ" and remove German from the list of tricky languages at https://dlang.org/library/std/uni/to_upper.html ? Should Turkish be listed ther

Re: Replacing tango.text.Ascii.isearch

2022-10-28 Thread Siarhei Siamashka via Digitalmars-d-learn
On Wednesday, 26 October 2022 at 06:05:14 UTC, Ali Çehreli wrote: The problem with Unicode is its main aim of allowing characters of multiple writing systems in the same text. When multiple writing systems are in play, conflicts and ambiguities will appear. I personally don't think that it's

Re: Importing modules under DUB on Windows

2022-10-28 Thread rikki cattermole via Digitalmars-d-learn
On 29/10/2022 4:15 AM, DLearner wrote: However, going forward, I don't want copies of OM anywhere other than UD. If you want your own private library on your system (that will get used a lot), you can create a package and use ``$ dub add-local .`` to add it to the available packages for looku

Re: ImportC in a Dub project

2022-10-28 Thread Imperatorn via Digitalmars-d-learn
On Friday, 28 October 2022 at 19:04:21 UTC, Carsten Schlote wrote: On Friday, 28 October 2022 at 18:56:03 UTC, Imperatorn wrote: Like schveiguy said, what's your build line? dmd should pick up the file if the import has the same name as the file. What do you mean with 'buildline'? The project

Re: ImportC in a Dub project

2022-10-28 Thread Steven Schveighoffer via Digitalmars-d-learn
On 10/28/22 2:43 PM, Carsten Schlote wrote: On Friday, 28 October 2022 at 18:31:25 UTC, Steven Schveighoffer wrote: Are you passing the c file to the compiler? Also, you must be using dmd for ImportC currently. What is your build line? ``` $ cat dub.json { "authors": [     "Carste

Re: ImportC in a Dub project

2022-10-28 Thread Carsten Schlote via Digitalmars-d-learn
On Friday, 28 October 2022 at 18:56:03 UTC, Imperatorn wrote: Like schveiguy said, what's your build line? dmd should pick up the file if the import has the same name as the file. What do you mean with 'buildline'? The project is build with dub. See previous posts with outputs from commandline

Re: ImportC in a Dub project

2022-10-28 Thread Imperatorn via Digitalmars-d-learn
On Friday, 28 October 2022 at 18:43:21 UTC, Carsten Schlote wrote: On Friday, 28 October 2022 at 18:31:25 UTC, Steven Schveighoffer wrote: [...] ``` $ cat dub.json { "authors": [ "Carsten Schlote" ], "copyright": "Copyright © 2022, Carsten Schlote",

Re: ImportC in a Dub project

2022-10-28 Thread Carsten Schlote via Digitalmars-d-learn
On Friday, 28 October 2022 at 18:31:25 UTC, Steven Schveighoffer wrote: Are you passing the c file to the compiler? Also, you must be using dmd for ImportC currently. What is your build line? ``` $ cat dub.json { "authors": [ "Carsten Schlote" ], "cop

Re: ImportC in a Dub project

2022-10-28 Thread Steven Schveighoffer via Digitalmars-d-learn
On 10/28/22 1:45 PM, Carsten Schlote wrote: Hi, I created a Dub project containing two files: app.d and zstd_binding.c ``` $ cat source/zstd_binding.c #include #include #include void relatedCode(void) { printf("Hallo! This is some output from C code!\n"); } ``` and ``` $ cat source/a

Re: ImportC in a Dub project

2022-10-28 Thread Carsten Schlote via Digitalmars-d-learn
On Friday, 28 October 2022 at 17:56:57 UTC, Imperatorn wrote: On Friday, 28 October 2022 at 17:45:59 UTC, Carsten Schlote wrote: Hi, I created a Dub project containing two files: app.d and zstd_binding.c [...] Are you using DMD? I'm using ``` $ dub --version DUB version 1.29.2, built on

Re: dub ldc2 static linking

2022-10-28 Thread Yura via Digitalmars-d-learn
On Friday, 28 October 2022 at 09:02:22 UTC, Kagamin wrote: On Friday, 28 October 2022 at 02:46:42 UTC, ryuukk_ wrote: I'm just right now having an issue with glibc version mismatch for my server Just compile with an old enough glibc, 2.14 works for me. Indeed, if I got it right it seems to b

Re: ImportC in a Dub project

2022-10-28 Thread Imperatorn via Digitalmars-d-learn
On Friday, 28 October 2022 at 17:45:59 UTC, Carsten Schlote wrote: Hi, I created a Dub project containing two files: app.d and zstd_binding.c [...] Are you using DMD?

ImportC in a Dub project

2022-10-28 Thread Carsten Schlote via Digitalmars-d-learn
Hi, I created a Dub project containing two files: app.d and zstd_binding.c ``` $ cat source/zstd_binding.c #include #include #include void relatedCode(void) { printf("Hallo! This is some output from C code!\n"); } ``` and ``` $ cat source/app.d import std.conv; import std.stdio;

Re: Importing modules under DUB on Windows

2022-10-28 Thread Adam D Ruppe via Digitalmars-d-learn
On Friday, 28 October 2022 at 15:15:04 UTC, DLearner wrote: Took suggestion, dub run then produced: `Linking... lld-link: error: subsystem must be defined Error: linker exited with status 1` That means the linker didn't see a `main` function. Make sure you have a `void main() {}` somewhere (an

Re: Importing modules under DUB on Windows

2022-10-28 Thread DLearner via Digitalmars-d-learn
On Friday, 28 October 2022 at 11:35:44 UTC, Adam D Ruppe wrote: On Wednesday, 26 October 2022 at 16:20:01 UTC, DLearner wrote: Wanted to use a function stored in a module outside the main source. easiest thing to do with dub is to add it as a sourcePath or a sourceFile. Well, actually, easies

Re: Importing modules under DUB on Windows

2022-10-28 Thread Adam D Ruppe via Digitalmars-d-learn
On Wednesday, 26 October 2022 at 16:20:01 UTC, DLearner wrote: Wanted to use a function stored in a module outside the main source. easiest thing to do with dub is to add it as a sourcePath or a sourceFile. Well, actually, easiest is to just copy the module right into your default src folder,

Re: how to benchmark pure functions?

2022-10-28 Thread Imperatorn via Digitalmars-d-learn
On Friday, 28 October 2022 at 09:48:14 UTC, ab wrote: On Thursday, 27 October 2022 at 17:17:01 UTC, ab wrote: [...] Thanks to H.S. Teoh and Dennis for the suggestions, they both work. I like the empty asm block a bit more because it is less invasive, but it only works with ldc. @Imperatorn

Re: how to benchmark pure functions?

2022-10-28 Thread ab via Digitalmars-d-learn
On Thursday, 27 October 2022 at 17:17:01 UTC, ab wrote: Hi, when trying to compare different implementations of the optimized builds of a pure function using benchmark from std.datetime.stopwatch, I get times equal to zero, I suppose because the functions are not executed as they do not have

Re: dub ldc2 static linking

2022-10-28 Thread Kagamin via Digitalmars-d-learn
On Friday, 28 October 2022 at 02:46:42 UTC, ryuukk_ wrote: I'm just right now having an issue with glibc version mismatch for my server Just compile with an old enough glibc, 2.14 works for me.