I try one more importC case, get this error:
```sh
Error: undefined identifier `__builtin_unreachable`
```
any tips to fix this?
On Monday, 26 February 2024 at 08:18:53 UTC, Richard (Rikki)
Andrew Cattermole wrote:
On 26/02/2024 9:04 PM, Dakota wrote:
I try one more importC case, get this error:
```sh
Error: undefined identifier `__builtin_unreachable`
```
any tips to fix this?
Reported: https://issues.dlang.org/show
When I use importC to build a c library, there is a lot unused
symbol missing.
I try add `-L--gc-sections` to dmd to workaround this issue.
I also try `-L-dead_strip` on macOS, it work as expected.
I do some google, some one suggestion use with
`-ffunction-sections`, `-f fdata-sections`, d
On Monday, 26 February 2024 at 12:33:02 UTC, Richard (Rikki)
Andrew Cattermole wrote:
On 27/02/2024 1:28 AM, Dakota wrote:
When I use importC to build a c library, there is a lot unused
symbol missing.
I try add `-L--gc-sections` to dmd to workaround this issue.
This removes symbols, not kee
On Monday, 26 February 2024 at 07:44:02 UTC, Dakota wrote:
I am use importC from linux, get this error:
```sh
/usr/include/x86_64-linux-gnu/bits/floatn-common.h(214): Error:
illegal combination of type specifiers
/usr/include/x86_64-linux-gnu/bits/floatn-common.h(251): Error:
illegal combinat
This is the type defined from c code import by importC:
```c
struct A {
int count;
int[] i;
}
```
This kind data need to be init as const to avoid runtime cost,
and need to be done from D code.
how can I do this ?
To put code into D source, I can use "-i=package" to
automatically
I try use
https://github.com/microsoft/garnet/blob/main/libs/storage/Tsavorite/cc/src/device/native_device_wrapper.cc from D
Not sure how to make this work with D:
```c++
EXPORTED_SYMBOL FASTER::core::Status
NativeDevice_ReadAsync(NativeDevice* device, uint64_t source,
void* dest, uint32_t
On Wednesday, 29 May 2024 at 09:01:13 UTC, evilrat wrote:
On Wednesday, 29 May 2024 at 07:47:01 UTC, Dakota wrote:
[...]
(here is the signature of callback)
https://github.com/microsoft/garnet/blob/ade2991f3737b9b5e3151d0dd0b614adfd4bcecd/libs/storage/Tsavorite/cc/src/device/async.h#L25
[...
this code give error:
```d
static if( !__traits(compiles, mixin("enum v = V;")) ) {
enum v = V;
}
```
```sh
Error: static variable `NotWorkVar` cannot be read at compile
time
```
V is alias get from `typeof(__traits(getMember, M, symbol)`, M
is `module` from importC.
the importC so
On Monday, 1 July 2024 at 11:15:46 UTC, Nick Treleaven wrote:
On Monday, 1 July 2024 at 07:32:30 UTC, Dakota wrote:
this code give error:
```d
static if( !__traits(compiles, mixin("enum v = V;")) ) {
enum v = V;
}
```
__traits(compiles, ...) can't check if a declaration is valid
directl
On Wednesday, 3 July 2024 at 21:47:32 UTC, Tim wrote:
If you only want to see the layout, you can use the following
command to dump it:
```
clang test.c -Xclang -fdump-record-layouts -c
```
File test.c could contain the following:
```
struct S
{
int a : 3;
int b : 29;
};
struct S dummy;
On Monday, 1 July 2024 at 11:15:46 UTC, Nick Treleaven wrote:
```
There is a case check will give wrong resutls:
```d
struct type_s
{
union {
struct
{
int a;
int b;
} c;
};
};
```
`type c` will return false with `enum isStatic(alias V
On Monday, 15 July 2024 at 11:16:23 UTC, Nick Treleaven wrote:
I put `type_s` in a file anonstruct.c, then:
```d
import anonstruct;
pragma(msg, isStatic!(type_s.c));
```
That outputs `false`, because the symbol is not a compile-time
value. Is that what you meant?
No, I am here deal with a lo
I am trying to translate some c code into d, get this error:
```d
struct A {
void* sub;
}
struct B {
void* subs;
}
__gshared {
const A[1] a0 = [
{ &b1_ptr },
];
const A[2] a1 = [
{ &b1_ptr },
];
const B b1 =
```c
#define ERR_SUCCESS 0
#define ERR_INVALID -1 // invalid argument
```
If the number >=0, it work. < 0 will not work.
DMD64 D Compiler v2.110.0-beta.1
```c
struct type_name {
int a;
}
int type_name(int a);
```
How can I get the function and type from importC? is there a
auto rename mechanism ?
On Saturday, 3 August 2024 at 11:55:53 UTC, Dennis wrote:
On Saturday, 3 August 2024 at 05:10:37 UTC, Dakota wrote:
How can I get the function and type from importC? is there a
auto rename mechanism ?
The most pragmatic workaround is to add a typedef to the C code:
```C
int S;
struct S { int
On Monday, 5 August 2024 at 11:35:56 UTC, Dennis wrote:
On Monday, 5 August 2024 at 11:02:24 UTC, Dakota wrote:
This will not work for me. (huge code base I can not change
and maintain)
You don't have to change the code where the type is defined per
se, you just need to put it in any C file
```c
typedef struct test_s
{
unsigned char _[64] __attribute__ ((aligned (sizeof (void
*;
} test_t;
```
```sh
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/mach/vm_types.h(168):
Error: variable `lib_test.mach_vm_range_recipe_v1_t.range` - no definition of
struct `mach_vm_range`
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.
dmd v2.110.0-beta.1
```sh
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h(145):
Error: found `__filename` when expecting `,`
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/inc
On Thursday, 8 August 2024 at 10:08:18 UTC, Dakota wrote:
dmd v2.110.0-beta.1
```c
#if defined(_DARWIN_UNLIMITED_STREAMS) ||
defined(_DARWIN_C_SOURCE)
FILE*fopen(const char * __restrict __filename, const char *
__restrict __mode) __DARWIN_ALIAS_STARTING(__MAC_10_6,
__IPHONE_3_2, __DAR
On Thursday, 22 August 2024 at 21:19:57 UTC, monkyyy wrote:
On Thursday, 22 August 2024 at 07:28:00 UTC, Dakota wrote:
Is there a way to link ldc objects with Emscripten to build
wasm binary ?
yes; you'll have to untangle my build system
https://github.com/crazymonkyyy/raylib-2024
It will al
23 matches
Mail list logo