Re: How to work with long paths on Windows?

2022-11-14 Thread Preetpal via Digitalmars-d-learn
On Monday, 14 November 2022 at 10:44:11 UTC, Imperatorn wrote: On Tuesday, 13 September 2022 at 19:54:15 UTC, Preetpal wrote: In Windows 10, Version 1607 (and later), you can [enable long paths](https://docs.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=registry) whi

Re: How to work with long paths on Windows?

2022-11-13 Thread Preetpal via Digitalmars-d-learn
In case anyone wants to see a working example of how to use long paths on Windows, I uploaded a [gist](https://gist.github.com/preetpalS/2fd6c6bf05a94734f89b70b679716bf3) (see my comment in the gist for how to make it work). It is an upgraded version of the original command line tool shown in the

Re: dub install package globally

2022-10-11 Thread Preetpal via Digitalmars-d-learn
On Thursday, 6 October 2022 at 08:50:02 UTC, christian.koestlin wrote: On Thursday, 6 October 2022 at 07:06:52 UTC, Preetpal wrote: Is there a way to install packages "globally" using dub? For example, when using the node package manager (NPM) you can install a package "globally" (so it is ava

dub install package globally

2022-10-06 Thread Preetpal via Digitalmars-d-learn
Is there a way to install packages "globally" using dub? For example, when using the node package manager (NPM) you can install a package "globally" (so it is available for the current user from the command line) using the `--global` flag as follows: `npm install --global typescript` This wo

Re: How to work with long paths on Windows?

2022-09-13 Thread Preetpal via Digitalmars-d-learn
On Tuesday, 13 September 2022 at 19:54:15 UTC, Preetpal wrote: In Windows 10, Version 1607 (and later), you can [enable long paths](https://docs.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=registry) which bypasses the MAX_PATH limitation for local paths (e.g., C:\Us

How to work with long paths on Windows?

2022-09-13 Thread Preetpal via Digitalmars-d-learn
In Windows 10, Version 1607 (and later), you can [enable long paths](https://docs.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=registry) which bypasses the MAX_PATH limitation for local paths (e.g., C:\Users\you\log.txt). Currently if you iterate over a directory with

Cross-compilation for Linux from Windows using DMD

2022-03-19 Thread Preetpal via Digitalmars-d-learn
Is this supposed to work out of the box (see: [Reddit Post](https://www.reddit.com/r/d_language/comments/sypgaj/dmd_supports_crosscompilation_with_os_switch/))? Trying to cross-compile a hello world program for Linux on Windows with the command **dmd -os=linux main.d** which gives no output on

Re: Example for Mir-Random fails

2021-04-03 Thread Preetpal via Digitalmars-d-learn
On Saturday, 3 April 2021 at 19:02:34 UTC, Brad wrote: Obviously it is a type mismatch - I have tried using to!uint to convert the result from unpredictableSeed to a type that will match - but that just causes more errors. Thank you in advance. I was able to compile the sample without any is

Re: Cannot deduce function from argument type when single candidate

2021-03-28 Thread Preetpal via Digitalmars-d-learn
On Monday, 29 March 2021 at 01:39:16 UTC, Adam D. Ruppe wrote: On Monday, 29 March 2021 at 01:24:13 UTC, Preetpal wrote: writeln(isRandomAccessRange(arr)); Template arguments are passed by !(), not just (). I believe you must also pass `typeof(arr)` since isRandomAccessRange is only inte

Cannot deduce function from argument type when single candidate

2021-03-28 Thread Preetpal via Digitalmars-d-learn
This is a minimal example that re-creates the error message. I am not understanding the error message that the compiler is giving me. From my understanding, the compiler is saying that there is a single possible candidate but it cannot figure out which one to choose. Why would it not choose the

Re: Endianness - How to test code for portability

2021-03-12 Thread Preetpal via Digitalmars-d-learn
On Friday, 12 March 2021 at 10:26:55 UTC, Dennis wrote: ``` version(BigEndian) { private enum bigEndian = true; } else { private enum bigEndian = false; } int parse(in ubyte[] data) { if (__ctfe || bigEndian) { // Portable code } else { // Little-endian optimized

Endianness - How to test code for portability

2021-03-11 Thread Preetpal via Digitalmars-d-learn
In the portability section of the language spec, they talk about endianness (https://dlang.org/spec/portability.html#endianness) which refers "to the order in which multibyte types are stored." IMO if you wanted to actually be sure your code is portable across both big endian and little endian

Re: dmd -> ldmd2: /usr/bin/ld.gold: error: .o: multiple definition of 'bool ldc.attributes...

2021-03-06 Thread Preetpal via Digitalmars-d-learn
On Saturday, 6 March 2021 at 22:14:26 UTC, kdevel wrote: After replacing dmd with ldmd2 (LDC 1.25.1) I get tons of link errors all of the form mentioned in the subject. Any idea what can be done about it? (With a handcrafted single compile/link statement using ldc2 everything compiles but id

Re: Restricting D applications to a single instance

2021-02-22 Thread Preetpal via Digitalmars-d-learn
On Monday, 22 February 2021 at 08:00:06 UTC, Ali Çehreli wrote: I achieve it with 'flock' (man 2 flock) on Linux. My case is different thoug: It allows me to have single writer and many readers of program data, which is kept inside a cache directory. All instances start with read permissionss t

Re: Restricting D applications to a single instance

2021-02-21 Thread Preetpal via Digitalmars-d-learn
On Monday, 22 February 2021 at 02:39:58 UTC, Steven Schveighoffer wrote: On 2/21/21 9:29 PM, Preetpal wrote: I want to restrict a D application to a single instance. Is there a way to do this using the D standard library? When you say "application", you mean a class or type? I decided to im

Re: Restricting D applications to a single instance

2021-02-21 Thread Preetpal via Digitalmars-d-learn
On Monday, 22 February 2021 at 02:39:58 UTC, Steven Schveighoffer wrote: On 2/21/21 9:29 PM, Preetpal wrote: I want to restrict a D application to a single instance. Is there a way to do this using the D standard library? When you say "application", you mean a class or type? I actually meant

Restricting D applications to a single instance

2021-02-21 Thread Preetpal via Digitalmars-d-learn
I want to restrict a D application to a single instance. Is there a way to do this using the D standard library? I know this can be done using named mutexes on Windows using Windows-specific APIs but I want to avoid this in general because I want to port the code to FreeBSD without introducing

Re: Mixed language projects (D and C++)

2021-02-19 Thread Preetpal via Digitalmars-d-learn
On Friday, 19 February 2021 at 10:21:29 UTC, Max Haughton wrote: On Friday, 19 February 2021 at 10:18:28 UTC, Preetpal wrote: On Friday, 19 February 2021 at 10:01:36 UTC, Max Haughton wrote: On Friday, 19 February 2021 at 09:44:15 UTC, Preetpal wrote: [...] C++ interop is used every day. The

Re: Mixed language projects (D and C++)

2021-02-19 Thread Preetpal via Digitalmars-d-learn
On Friday, 19 February 2021 at 10:01:36 UTC, Max Haughton wrote: On Friday, 19 February 2021 at 09:44:15 UTC, Preetpal wrote: I want to reuse existing C++ code in a new project that I am writing in D and I want to use D in an existing C++ code base (it is not large). I do not anticipate interop

Mixed language projects (D and C++)

2021-02-19 Thread Preetpal via Digitalmars-d-learn
I want to reuse existing C++ code in a new project that I am writing in D and I want to use D in an existing C++ code base (it is not large). I do not anticipate interop being an issue. I am wondering if mixing D and C++ is a common practice? If it is a common practice, is anyone is currently