Re: win32 api & lib issue

2023-11-04 Thread Imperatorn via Digitalmars-d-learn
On Saturday, 4 November 2023 at 18:30:41 UTC, Imperatorn wrote: On Friday, 3 November 2023 at 00:57:30 UTC, Peter Hu wrote: On Thursday, 2 November 2023 at 17:38:33 UTC, Imperatorn wrote: On Thursday, 2 November 2023 at 13:40:14 UTC, Peter Hu wrote: [...] I put it on dub now so you can just

Re: Convert String to Date and Add ±N Hours

2023-11-04 Thread Steven Schveighoffer via Digitalmars-d-learn
On Saturday, 4 November 2023 at 18:11:53 UTC, Vahid wrote: Hi, I have a date string with the format of "2023-11-04 23:10:20". I want to convert this string to Date object and also, add ±N hours to it. For example: `"2023-11-04 23:10:20" + "+2:00" = "2023-11-05 01:10:20"` `"2023-11-04

Re: DUB: Is it possible to set release as a default build for a dub package?

2023-11-04 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, November 3, 2023 1:21:42 PM MDT BoQsc via Digitalmars-d-learn wrote: > While using `dub`, you might notice that after running `dub` or > `dub run` command you will end up with notice: > > ``` > Starting Performing "debug" build using > C:\D\dmd2\windows\bin64\dmd.exe for x86_64. > ```

Re: Convert String to Date and Add ±N Hours

2023-11-04 Thread Jonathan M Davis via Digitalmars-d-learn
On Saturday, November 4, 2023 12:11:53 PM MDT Vahid via Digitalmars-d-learn wrote: > Hi, > > I have a date string with the format of "2023-11-04 23:10:20". I > want to convert this string to Date object and also, add ±N hours > to it. For example: > > `"2023-11-04 23:10:20" + "+2:00" =

Re: win32 api & lib issue

2023-11-04 Thread Imperatorn via Digitalmars-d-learn
On Friday, 3 November 2023 at 00:57:30 UTC, Peter Hu wrote: On Thursday, 2 November 2023 at 17:38:33 UTC, Imperatorn wrote: On Thursday, 2 November 2023 at 13:40:14 UTC, Peter Hu wrote: [...] I put it on dub now so you can just do "dub add dfl". In Entice designer you can then change your

Convert String to Date and Add ±N Hours

2023-11-04 Thread Vahid via Digitalmars-d-learn
Hi, I have a date string with the format of "2023-11-04 23:10:20". I want to convert this string to Date object and also, add ±N hours to it. For example: `"2023-11-04 23:10:20" + "+2:00" = "2023-11-05 01:10:20"` `"2023-11-04 23:10:20" + "-2:30" = "2023-11-05 20:40:20"` How can I do this?

Re: Why can't we use strings in C++ methods?

2023-11-04 Thread Dadoum via Digitalmars-d-learn
On Saturday, 4 November 2023 at 14:33:56 UTC, Basile B. wrote: [...] Now there is still the question whether the `extern(C)` code will work as expected or not. So with few patches could we make it work? DMD can write the C++ function prototype (as it does it with `extern (C)`) and then

Re: Why can't we use strings in C++ methods?

2023-11-04 Thread Emmanuel Danso Nyarko via Digitalmars-d-learn
On Saturday, 4 November 2023 at 14:21:49 UTC, Paul Backus wrote: On Saturday, 4 November 2023 at 03:00:49 UTC, Dadoum wrote: [...] `extern(C++)` functions use C++ name mangling, which includes the types of the parameters in the mangled name. However, since C++ does not have a built-in slice

Re: Why can't we use strings in C++ methods?

2023-11-04 Thread Imperatorn via Digitalmars-d-learn
On Saturday, 4 November 2023 at 14:33:56 UTC, Basile B. wrote: On Saturday, 4 November 2023 at 13:51:20 UTC, Dadoum wrote: [...] The type simply cannot be mangled using the C++ mangler as it does not exist over there. You might have the impression that this should be allowed, e.g as an

Re: Why can't we use strings in C++ methods?

2023-11-04 Thread Emmanuel Danso Nyarko via Digitalmars-d-learn
On Saturday, 4 November 2023 at 13:51:20 UTC, Dadoum wrote: On Saturday, 4 November 2023 at 13:45:56 UTC, Emmanuel Danso Nyarko wrote: [...] There is a syntax disagreement here that's why the D compiler is instantly stopping you from doing any symbol generated interaction with string in C++

Re: Why can't we use strings in C++ methods?

2023-11-04 Thread Dadoum via Digitalmars-d-learn
On Saturday, 4 November 2023 at 14:21:49 UTC, Paul Backus wrote: [...] `extern(C++)` functions use C++ name mangling, which includes the types of the parameters in the mangled name. However, since C++ does not have a built-in slice type like D's `T[]`, there is no valid C++ mangling for a D

Re: Why can't we use strings in C++ methods?

2023-11-04 Thread Basile B. via Digitalmars-d-learn
On Saturday, 4 November 2023 at 13:51:20 UTC, Dadoum wrote: On Saturday, 4 November 2023 at 13:45:56 UTC, Emmanuel Danso Nyarko wrote: [...] There is a syntax disagreement here that's why the D compiler is instantly stopping you from doing any symbol generated interaction with string in C++

Re: Why can't we use strings in C++ methods?

2023-11-04 Thread Paul Backus via Digitalmars-d-learn
On Saturday, 4 November 2023 at 03:00:49 UTC, Dadoum wrote: I was wondering why C++ linkage forbids strings as arguments while we can with the C one. With C linkage, it's translated to a template that's defined in the automatically generated header, but it just doesn't compile in C++.

Re: performance issues with SIMD function

2023-11-04 Thread Guillaume Piolat via Digitalmars-d-learn
On Friday, 3 November 2023 at 15:11:31 UTC, Bogdan wrote: Can anyone help me to understand what I am missing? Your loop is likely dominated by sin() calls, And the rest of the loop isn't complicated enough to outperform the compiler. What you could do is use the intrinsics to implement a

Re: Why can't we use strings in C++ methods?

2023-11-04 Thread Dadoum via Digitalmars-d-learn
On Saturday, 4 November 2023 at 13:45:56 UTC, Emmanuel Danso Nyarko wrote: [...] There is a syntax disagreement here that's why the D compiler is instantly stopping you from doing any symbol generated interaction with string in C++ interop. C++ doesn't know 'string' and C++ mangles with

Re: Why can't we use strings in C++ methods?

2023-11-04 Thread Emmanuel Danso Nyarko via Digitalmars-d-learn
On Saturday, 4 November 2023 at 12:34:28 UTC, Dadoum wrote: On Saturday, 4 November 2023 at 12:01:11 UTC, Emmanuel Danso Nyarko wrote: [...] So C-strings are just an array of characters that are governed by simple functions and D strings also defined the same. So you could see that D strings

Re: Why can't we use strings in C++ methods?

2023-11-04 Thread Emmanuel Danso Nyarko via Digitalmars-d-learn
On Saturday, 4 November 2023 at 12:21:45 UTC, Johan wrote: On Saturday, 4 November 2023 at 12:01:11 UTC, Emmanuel Danso Nyarko wrote: On Saturday, 4 November 2023 at 11:18:02 UTC, Dadoum wrote: ```d extern (C) void hello(string arg) { import std.stdio; writeln(arg); } ``` Compiles

Re: Why can't we use strings in C++ methods?

2023-11-04 Thread Dadoum via Digitalmars-d-learn
On Saturday, 4 November 2023 at 12:01:11 UTC, Emmanuel Danso Nyarko wrote: [...] So C-strings are just an array of characters that are governed by simple functions and D strings also defined the same. So you could see that D strings are possibly built on the architecture of C strings. In

Re: Why can't we use strings in C++ methods?

2023-11-04 Thread Johan via Digitalmars-d-learn
On Saturday, 4 November 2023 at 12:01:11 UTC, Emmanuel Danso Nyarko wrote: On Saturday, 4 November 2023 at 11:18:02 UTC, Dadoum wrote: ```d extern (C) void hello(string arg) { import std.stdio; writeln(arg); } ``` Compiles fine with dmd, ldc2 and gdc. ```d extern (C++) void

Re: Why can't we use strings in C++ methods?

2023-11-04 Thread Dadoum via Digitalmars-d-learn
On Saturday, 4 November 2023 at 12:07:12 UTC, Imperatorn wrote: [...] We can just assume what you're doing on the C++-side. Are you using std::string? You could try as a pointer + length and it might work, but without seeing your complete code it's quite hard to know what you want to do.

Re: Why can't we use strings in C++ methods?

2023-11-04 Thread Dadoum via Digitalmars-d-learn
On Saturday, 4 November 2023 at 12:21:45 UTC, Johan wrote: On Saturday, 4 November 2023 at 12:01:11 UTC, Emmanuel Danso Nyarko wrote: On Saturday, 4 November 2023 at 11:18:02 UTC, Dadoum wrote: ```d extern (C) void hello(string arg) { import std.stdio; writeln(arg); } ``` Compiles

Re: Why can't we use strings in C++ methods?

2023-11-04 Thread Imperatorn via Digitalmars-d-learn
On Saturday, 4 November 2023 at 11:18:02 UTC, Dadoum wrote: On Saturday, 4 November 2023 at 10:08:20 UTC, Imperatorn wrote: On Saturday, 4 November 2023 at 03:00:49 UTC, Dadoum wrote: I was wondering why C++ linkage forbids strings as arguments while we can with the C one. With C linkage,

Re: Why can't we use strings in C++ methods?

2023-11-04 Thread Emmanuel Danso Nyarko via Digitalmars-d-learn
On Saturday, 4 November 2023 at 11:18:02 UTC, Dadoum wrote: On Saturday, 4 November 2023 at 10:08:20 UTC, Imperatorn wrote: On Saturday, 4 November 2023 at 03:00:49 UTC, Dadoum wrote: I was wondering why C++ linkage forbids strings as arguments while we can with the C one. With C linkage,

Re: DUB: Is it possible to set release as a default build for a dub package?

2023-11-04 Thread BoQsc via Digitalmars-d-learn
On Friday, 3 November 2023 at 21:57:57 UTC, Andrey Zherikov wrote: On Friday, 3 November 2023 at 19:21:42 UTC, BoQsc wrote: However I would want to try to enforce this behaviour from the `dub.json` or `dub.sdl` file. IMHO this is not something that should be enforced from package build

Re: Why can't we use strings in C++ methods?

2023-11-04 Thread Dadoum via Digitalmars-d-learn
On Saturday, 4 November 2023 at 10:08:20 UTC, Imperatorn wrote: On Saturday, 4 November 2023 at 03:00:49 UTC, Dadoum wrote: I was wondering why C++ linkage forbids strings as arguments while we can with the C one. With C linkage, it's translated to a template that's defined in the

Re: performance issues with SIMD function

2023-11-04 Thread Bogdan via Digitalmars-d-learn
On Friday, 3 November 2023 at 15:32:08 UTC, Sergey wrote: On Friday, 3 November 2023 at 15:11:31 UTC, Bogdan wrote: Hi everyone, I was playing around with the intel-intrinsics library, trying to improve the speed of a simple area function. I could not see any performance improvements from

Re: Why can't we use strings in C++ methods?

2023-11-04 Thread Imperatorn via Digitalmars-d-learn
On Saturday, 4 November 2023 at 03:00:49 UTC, Dadoum wrote: I was wondering why C++ linkage forbids strings as arguments while we can with the C one. With C linkage, it's translated to a template that's defined in the automatically generated header, but it just doesn't compile in C++. Can