On 6/15/23 2:21 PM, bachmeier wrote:
On Thursday, 15 June 2023 at 15:53:57 UTC, Steven Schveighoffer wrote:
On 6/15/23 10:04 AM, Jonathan M Davis wrote:
On Thursday, June 15, 2023 7:18:06 AM MDT Steven Schveighoffer via
Digitalmars-d-learn wrote:
But in general, if you want a mutable character
On Thursday, 15 June 2023 at 15:53:57 UTC, Steven Schveighoffer
wrote:
On 6/15/23 10:04 AM, Jonathan M Davis wrote:
On Thursday, June 15, 2023 7:18:06 AM MDT Steven Schveighoffer
via
Digitalmars-d-learn wrote:
But in general, if you want a mutable character array that's
zero
terminated, you ne
On 6/15/23 10:04 AM, Jonathan M Davis wrote:
On Thursday, June 15, 2023 7:18:06 AM MDT Steven Schveighoffer via
Digitalmars-d-learn wrote:
But in general, if you want a mutable character array that's zero
terminated, you need to make a copy with a zero terminator, but type it
as mutable. I'm sur
On Thursday, June 15, 2023 7:18:06 AM MDT Steven Schveighoffer via
Digitalmars-d-learn wrote:
> But in general, if you want a mutable character array that's zero
> terminated, you need to make a copy with a zero terminator, but type it
> as mutable. I'm surprised there isn't a way to do this easil
On 6/15/23 9:18 AM, Steven Schveighoffer wrote:
So interestingly enough, toStringz is pure, and returns an unrelated
type, so you shouldn't need to cast. However, for some reason, it does
require a cast. That seems like a bug to me.
Oh wait, a pure function can return immutable data that isn't
On 6/14/23 11:29 PM, Pat Maddox wrote:
Hi there, I want to call a C function that upcases a string. I have
something working, I just want to check in here to see if there's a
better approach that I'm missing. I ask because `std.string.toStringZ()`
returns an `immutable char *`.
As far as I ca
Hi there, I want to call a C function that upcases a string. I
have something working, I just want to check in here to see if
there's a better approach that I'm missing. I ask because
`std.string.toStringZ()` returns an `immutable char *`.
As far as I can tell, I have two options:
1. Make the
On Tuesday, 30 June 2020 at 12:22:15 UTC, Steven Schveighoffer
wrote:
(i.e. one cannot use extern(D) functions for C callbacks).
I don't think that's a big issue. Honestly, I don't think it's an
issue at all.
BTW, the order of arguments is not the only thing. Variadic
functions in D and C
On 6/30/20 3:00 AM, Kagamin wrote:
On Monday, 29 June 2020 at 19:55:59 UTC, Steven Schveighoffer wrote:
Yep, for sure. I'll file an issue. Anyone know why the calling
convention would differ?
It's easier to enforce left to right evaluation order this way:
arguments are pushed to stack as they
On Monday, 29 June 2020 at 19:55:59 UTC, Steven Schveighoffer
wrote:
Yep, for sure. I'll file an issue. Anyone know why the calling
convention would differ?
It's easier to enforce left to right evaluation order this way:
arguments are pushed to stack as they are evaluated, which is
pascal cal
On 6/29/20 1:50 PM, Jacob Carlborg wrote:
On Monday, 29 June 2020 at 16:34:33 UTC, Steven Schveighoffer wrote:
Are you sure? On the ABI page [1] , it says "The extern (C) and extern
(D) calling convention matches the C calling convention used by the
supported C compiler on the host system."
On Monday, 29 June 2020 at 16:34:33 UTC, Steven Schveighoffer
wrote:
Are you sure? On the ABI page [1] , it says "The extern (C) and
extern (D) calling convention matches the C calling convention
used by the supported C compiler on the host system."
In that case the documentation is wrong. H
On 6/26/20 4:15 AM, Jacob Carlborg wrote:
On Friday, 26 June 2020 at 00:30:22 UTC, Denis wrote:
I have a two questions about calling C functions from D.
(1) When passing a D callback to a C function, is there a way to write
the code without having to prefix the callback declaration with
On 2020-06-26 18:54, Denis wrote:
OK, now this makes sense.
I tested calling the same callback function directly from D: it compiled
and worked correctly. So at least prefixing the callback function with
`extern(C)` doesn't prevent the rest of the D program from calling it too.
No, of cours
On Friday, 26 June 2020 at 08:15:27 UTC, Jacob Carlborg wrote:
On Friday, 26 June 2020 at 00:30:22 UTC, Denis wrote:
extern(C) void cfunc(void function(int));
extern(C) void dcallback(int x) {...} <-- Why extern(C)?
cfunc(&dcallback);
Can this be rewritten, dropping the prefix f
On Friday, 26 June 2020 at 00:30:22 UTC, Denis wrote:
I have a two questions about calling C functions from D.
(1) When passing a D callback to a C function, is there a way
to write the code without having to prefix the callback
declaration with "extern(C)"?
It's not a big
I have a two questions about calling C functions from D.
(1) When passing a D callback to a C function, is there a way to
write the code without having to prefix the callback declaration
with "extern(C)"?
It's not a big deal adding the prefix to the D function
declaration. It
On 12/9/2010 10:04 PM, Jesse Phillips wrote:
CrypticMetaphor Wrote:
It is a linker bug, so Oplink is at fault. What is the bug number you submitted?
bug number: 5337
http://d.puremagic.com/issues/show_bug.cgi?id=5337
I almost forgot I wrote that dtips page! Thanks for bringing it up.
I just updated it to include a brief note on __gshared. The rest of it should
still work, though. Calling C functions is pretty easy.
CrypticMetaphor Wrote:
> On 12/9/2010 5:28 PM, Steven Schveighoffer wrote:
>
> > Yes please, and be sure to specify that it correctly does not compile on
> > linux. http://d.puremagic.com/issues/enter_bug.cgi
>
> > -Steve
>
> Alright then!
>
> I submitted a my first bug report and added __gshare
On Thu, 09 Dec 2010 12:24:05 -0500, Andrej Mitrovic
wrote:
On 12/9/10, Steven Schveighoffer wrote:
__gshared is unprotected sharing, and the type system is not aware that
it
is shared. Can you remember what specifically you were doing with the
variable?
My dev PC is in repairs right no
On 12/9/10, Steven Schveighoffer wrote:
> __gshared is unprotected sharing, and the type system is not aware that it
> is shared. Can you remember what specifically you were doing with the
> variable?
My dev PC is in repairs right now so I don't have the code atm. It's a
project that works with
On 12/9/2010 5:28 PM, Steven Schveighoffer wrote:
On Thu, 09 Dec 2010 10:15:59 -0500, CrypticMetaphor
wrote:
On 12/9/2010 3:57 PM, Steven Schveighoffer wrote:
On Thu, 09 Dec 2010 09:37:03 -0500, CrypticMetaphor
wrote:
I found this page that describes how to call c functions from D.
I foun
On Thu, 09 Dec 2010 11:38:00 -0500, Andrej Mitrovic
wrote:
I know I prefer using shared() when interfacing with C.
I've tried using __gshared once when interfacing with C code. But I
had crashes all the time, using shared instead made my app stable
again. It might be related to the way the C
I know I prefer using shared() when interfacing with C.
I've tried using __gshared once when interfacing with C code. But I
had crashes all the time, using shared instead made my app stable
again. It might be related to the way the C code worked, since
multiple threads were involved. Anyway.. that
On Thu, 09 Dec 2010 10:15:59 -0500, CrypticMetaphor
wrote:
On 12/9/2010 3:57 PM, Steven Schveighoffer wrote:
On Thu, 09 Dec 2010 09:37:03 -0500, CrypticMetaphor
wrote:
I found this page that describes how to call c functions from D.
I found this page that describes how:
http://arsdnet.ne
On 12/9/2010 3:57 PM, Steven Schveighoffer wrote:
On Thu, 09 Dec 2010 09:37:03 -0500, CrypticMetaphor
wrote:
I found this page that describes how to call c functions from D.
I found this page that describes how:
http://arsdnet.net/dtips/#cfunc
on that page he uses gcc, and I use dmc, but I g
On Thu, 09 Dec 2010 09:37:03 -0500, CrypticMetaphor
wrote:
I found this page that describes how to call c functions from D.
I found this page that describes how:
http://arsdnet.net/dtips/#cfunc
on that page he uses gcc, and I use dmc, but I get different results.
This is what I did
// c
I found this page that describes how to call c functions from D.
I found this page that describes how:
http://arsdnet.net/dtips/#cfunc
on that page he uses gcc, and I use dmc, but I get different results.
This is what I did
// cfile.c file
extern int globalFromD;
void functionFromC(int a) {
29 matches
Mail list logo