clang suport multi-memory with flags
`--wasm-features=multi-memory`, is LDC support `multi-memory`
without c code?
On Monday, 13 January 2025 at 14:52:05 UTC, Matheus Catarino
wrote:
On Monday, 13 January 2025 at 11:36:45 UTC, Dakota wrote:
You could simply use dstep or dmd/ldc2 `-H`|`-Hf=`.
Thanks for tips.
My point is c allot align to alias, is D support it ?
I want avoid importC, because I want to w
```c
#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L)
# include
#endif
#if defined(_MSC_VER)
/* do not use alignment for older visual studio versions */
# if _MSC_VER < 1913 /* Visual Studio 2017 version 15.6 */
#define CGLM_ALL_UNALIGNED
#define CGLM_ALIGN(X) /* no alig
On Saturday, 23 November 2024 at 12:09:22 UTC, IchorDev wrote:
Why not load the libraries at runtime and look the pointers up
with symbol names? Or do you really need the compiler to do it
for you?
Thanks for suggestion.
Because I need link some part static c library, they link global
var
Try build a dynamic library, a lot function symbol and global
symbol need to be deferred binding from runtime app.
It can be done by pass `-Wl,-undefined,dynamic_lookup` or
`--unresolved-symbols=dynamic_lookup` to linker.
I am look a way to do it from d code, like
`pragma(linkerDirective,
On Wednesday, 20 November 2024 at 07:02:25 UTC, Dakota wrote:
I am sure it defined because I add static assert to confirm
this `config.d`:
and not sure how to work this around:
```sh
#0 0x000103d4e8f7
llvm::sys::PrintStackTrace(llvm::raw_ostream&, int)
(/ldc/bin/ldc2+0x1038098f7)
#1
```sh
/ldc/import/core/stdc/stdint.d(96): Error: undefined identifier
`cpp_longlong`
/ldc/import/core/stdc/stdint.d(97): Error: undefined identifier
`cpp_ulonglong`
/ldc/import/core/stdc/stdint.d(118): Error: undefined identifier
`cpp_ulong`
```
I am sure it defined because I add static asser
On Tuesday, 15 October 2024 at 15:29:09 UTC, ryuukk_ wrote:
[...]
Thanks very much.
seems not able to import sigjmp_buf for macOS.
On Tuesday, 15 October 2024 at 12:13:36 UTC, monkyyy wrote:
Your probably going to need to simplify that block of code
looks awful
source code here:
https://github.com/bellard/quickjs/blob/master/quickjs.h#L1045
```c
typedef union JSCFunctionType {
JSCFunction *generic;
JSValue (*generic_magic)(JSContext *ctx, JSValueConst
this_val, int argc, JSValueConst *argv, int magic);
JSCFunction *constructor;
JSValue (*constructor_magic)(JSContext *ctx, JSValueConst
new_target, int argc, JSValueC
On Saturday, 28 September 2024 at 08:35:39 UTC, Johan wrote:
On Saturday, 28 September 2024 at 07:54:40 UTC, Dakota wrote:
```c
struct __attribute__((packed)) type1 {
uint32_tu32;
uint8_t u8;
uint16_tu16a;
uint16_tu16b;
uint8_t u8a;
On Friday, 20 September 2024 at 16:21:10 UTC, Nick Treleaven
wrote:
On Friday, 20 September 2024 at 09:38:54 UTC, Dakota wrote:
Thanks to Dennis for the workaround.
Thanks your all for the tips, void solution fix me problem.
I need my struct defined as `isZeroInit`, so can I can import
them as `di` file. (this also reduce build size)
But I find this problem with float inside union:
```d
struct test_t {
union {
int i32;
float f32;
}
}
static assert(__traits(isZeroInit, test_t) );
```
``
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
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
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
```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.
```c
typedef struct test_s
{
unsigned char _[64] __attribute__ ((aligned (sizeof (void
*;
} test_t;
```
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
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
```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 ?
```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
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 =
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
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 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:
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
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 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
[...
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
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
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
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
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 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
I try one more importC case, get this error:
```sh
Error: undefined identifier `__builtin_unreachable`
```
any tips to fix this?
37 matches
Mail list logo