request assistance resolving curl error

2024-03-26 Thread confuzzled via Digitalmars-d-learn
Hello all, I have two scripts. I copied the first directly from the alpaca website and massaged it with etc.c.curl until it compiled in D. The result is that it creates the order and returns the result to stdout. In the second script, I tried to use std.net.curl but cannot get it to work.

Re: Best way to use large C library in D as of 2024

2024-03-26 Thread bachmeier via Digitalmars-d-learn
On Tuesday, 26 March 2024 at 19:24:39 UTC, Chris Piker wrote: Hi D I have a C library I use for work, it's maintained by an external organization that puts it through a very through test framework. Though source code is supplied, the intended use is to include the header files and link

Best way to use large C library in D as of 2024

2024-03-26 Thread Chris Piker via Digitalmars-d-learn
Hi D I have a C library I use for work, it's maintained by an external organization that puts it through a very through test framework. Though source code is supplied, the intended use is to include the header files and link against pre-compiled code. What is the best way, as of 2024 to

Re: Best way to use large C library in D as of 2024

2024-03-26 Thread Chris Piker via Digitalmars-d-learn
On Tuesday, 26 March 2024 at 20:19:27 UTC, bachmeier wrote: Should be able to just use it, as described here: https://forum.dlang.org/post/qxctappnigkwvaqak...@forum.dlang.org Create a .c file that includes the header files and then call the functions you need. Wow. **That just worked the

Re: Best way to use large C library in D as of 2024

2024-03-26 Thread bachmeier via Digitalmars-d-learn
On Tuesday, 26 March 2024 at 20:42:00 UTC, Chris Piker wrote: On Tuesday, 26 March 2024 at 20:19:27 UTC, bachmeier wrote: Should be able to just use it, as described here: https://forum.dlang.org/post/qxctappnigkwvaqak...@forum.dlang.org Create a .c file that includes the header files and

Re: Hidden members of Class objects

2024-03-26 Thread Carl Sturtivant via Digitalmars-d-learn
On Thursday, 7 March 2024 at 00:38:30 UTC, Richard (Rikki) Andrew Cattermole wrote: Yes its opt-in. https://dlang.org/spec/statement.html#synchronized-statement As you mentioned in another thread there's handy ABI documentation for classes and interfaces just here

Re: request assistance resolving curl error

2024-03-26 Thread Andrea Fontana via Digitalmars-d-learn
On Tuesday, 26 March 2024 at 07:13:24 UTC, confuzzled wrote: Hello all, I have two scripts. I copied the first directly from the alpaca website and massaged it with etc.c.curl until it compiled in D. The result is that it creates the order and returns the result to stdout. In the second

Re: Why is this code slow?

2024-03-26 Thread Csaba via Digitalmars-d-learn
On Sunday, 24 March 2024 at 21:21:13 UTC, kdevel wrote: Usually you do not translate mathematical expressions directly into code: ``` n += pow(-1.0, i - 1.0) / (i * 2.0 - 1.0); ``` The term containing the `pow` invocation computes the alternating sequence -1, 1, -1, ..., which can be

Re: Why is this code slow?

2024-03-26 Thread Salih Dincer via Digitalmars-d-learn
On Monday, 25 March 2024 at 14:02:08 UTC, rkompass wrote: Of course you may also combine the up(+) and down(-) step to one: 1/i - 1/(i+2) = 2/(i*(i+2)) ```d double leibniz(int iter) { double n = 0.0; for (int i = 1; i < iter; i+=4) n += 2.0 / (i * (i+2.0)); return n * 4.0; } ```

Re: Why is this code slow?

2024-03-26 Thread Lance Bachmeier via Digitalmars-d-learn
On Sunday, 24 March 2024 at 19:31:19 UTC, Csaba wrote: I know that benchmarks are always controversial and depend on a lot of factors. So far, I read that D performs very well in benchmarks, as well, if not better, as C. I wrote a little program that approximates PI using the Leibniz

Re: Why is this code slow?

2024-03-26 Thread Lance Bachmeier via Digitalmars-d-learn
On Tuesday, 26 March 2024 at 14:25:53 UTC, Lance Bachmeier wrote: On Sunday, 24 March 2024 at 19:31:19 UTC, Csaba wrote: I know that benchmarks are always controversial and depend on a lot of factors. So far, I read that D performs very well in benchmarks, as well, if not better, as C. I