Is there a -Dmacro like option for D compilers?

2023-03-27 Thread Jeremy via Digitalmars-d-learn
Is there a way I can define a manifest constant from the compiler command-line, like the -Dmacro option for C compilers?

Re: std.net.curl.HTTP: can't download more than 3.6K

2023-03-19 Thread Jeremy via Digitalmars-d-learn
Nevermind, it was my fault. I fixed my problem by appending the received buffer to my data buffer instead of overwriting my data buffer each time.

Re: Difference between using `import` with/without the colon

2023-03-19 Thread Jeremy via Digitalmars-d-learn
On Sunday, 19 March 2023 at 08:47:32 UTC, Basile B. wrote: On Sunday, 19 March 2023 at 07:20:17 UTC, Jeremy wrote: [...] The colon-form, aka "selective import" has for effect 1. to create a local alias so this can indeed speedup symbol lookups in the sense that search will succeed before loo

Difference between using `import` with/without the colon

2023-03-19 Thread Jeremy via Digitalmars-d-learn
Hello, is there any difference at all between the following lines, as an example: ```d import std.regex; import std.regex : matchFirst; ``` What technical differences does it make (except for having the identifier available), using the colon? Does it make any speed/optimization changes or am I

std.net.curl.HTTP: can't download more than 3.6K

2023-03-19 Thread Jeremy via Digitalmars-d-learn
Hello, I'm new to D and the `std.net.curl` library. I'm using the `HTTP` struct because I need to set headers for an API, and most of the time, I can only download 3.6 kilobytes at a time. Would this be a problem with the library not following redirects or something else? I'm not really sure wh

Re: #define-like behavior

2023-03-14 Thread Jeremy via Digitalmars-d-learn
On Tuesday, 14 March 2023 at 06:20:29 UTC, Mike Parker wrote: On Tuesday, 14 March 2023 at 05:47:35 UTC, Jeremy wrote: [...] Manifest constants in D have a similar effect as #defined values, e.g.: [...] Thanks a lot!

#define-like behavior

2023-03-13 Thread Jeremy via Digitalmars-d-learn
Hi, in C and C++ you can use #define to substitute a value in place of an identifier while preprocessing. If you initialize a new string and don't change its value after that, will the compiler substitute the string identifier with its value, like #define in C, or will it make a string in memor

Re: Directly compiling a D program with other libraries

2023-03-13 Thread Jeremy via Digitalmars-d-learn
That's a linker error, meaning the missing symbol isn't available to link into the executable. You need to compile the source of all the libraries you use and make sure the resultant binaries are available for the linker to link into the executable. The -I switch you've passed tells the compi

Directly compiling a D program with other libraries

2023-03-12 Thread Jeremy via Digitalmars-d-learn
Hello, I am new to this forum and to D. I am trying to compile a basic D program with libraries (`requests` which requires `cachetools` and `automem`) without using dub. I have never used dub before, only a compiler. The folders containing the libraries are in the same folder as main.d, the