On Monday, 4 January 2021 at 18:05:40 UTC, tsbockman wrote:
/* XXX: haven't done private members yet, wonder if they're
needed to
* complete this */
Leaving out the private members of a struct changes its size,
and sometimes its alignment. This will definitely break things
if you ever
On Monday, 4 January 2021 at 17:24:27 UTC, Steven Schveighoffer
wrote:
On 1/3/21 9:17 PM, bdh wrote:
On Sunday, 3 January 2021 at 11:16:25 UTC, rikki cattermole
wrote:
Your definition of Image is probably wrong.
You may have missed a pointer (8 bytes).
[...]
How to test:
in D-land:
On Monday, 4 January 2021 at 16:35:23 UTC, Jack wrote:
Do you mean fill .filename member from a D string? something
like this?
[...]
// since .filename isn't a pointer but an array, I think
// you have to use memcpy() here. = operator wouldn't work
properly.
memcpy([0], [0],
On Monday, 4 January 2021 at 02:17:33 UTC, bdh wrote:
I'm pretty sure it's correct?
Here's the D version:
https://repo.or.cz/magickd.git/blob/e5d06e939:/source/magickd/core/c/image.d#l751
Here's the C version:
On 1/3/21 9:17 PM, bdh wrote:
On Sunday, 3 January 2021 at 11:16:25 UTC, rikki cattermole wrote:
Your definition of Image is probably wrong.
You may have missed a pointer (8 bytes).
I'm pretty sure it's correct?
Here's the D version:
On Sunday, 3 January 2021 at 08:43:34 UTC, bdh wrote:
Hi,
I'm trying to create bindings to the GraphcicsMagick C library
which has the following struct defined:
[...]
Do you mean fill .filename member from a D string? something like
this?
import std.stdio;
[...]
struct Image
On Sunday, 3 January 2021 at 11:16:25 UTC, rikki cattermole wrote:
Your definition of Image is probably wrong.
You may have missed a pointer (8 bytes).
I'm pretty sure it's correct?
Here's the D version:
https://repo.or.cz/magickd.git/blob/e5d06e939:/source/magickd/core/c/image.d#l751
Your definition of Image is probably wrong.
You may have missed a pointer (8 bytes).
On Sunday, 3 January 2021 at 09:28:55 UTC, rikki cattermole wrote:
import std;
void main()
{
int[] a = [1, 2, 3, 4, 5];
int[3] b;
b[0 .. 3] = a[1 .. 4];
b.writeln;
}
Same principle, just remember to null terminate after slicing
your dynamic array and assigning it to your
import std;
void main()
{
int[] a = [1, 2, 3, 4, 5];
int[3] b;
b[0 .. 3] = a[1 .. 4];
b.writeln;
}
Same principle, just remember to null terminate after slicing your
dynamic array and assigning it to your static array.
Hi,
I'm trying to create bindings to the GraphcicsMagick C library
which has the following struct defined:
#define MaxTextExtent 2053
typedef struct _Image {
/* other members skipped */
char filename[MaxTextExtent];
} Image;
In an `extern (C)` block I've "converted"
11 matches
Mail list logo