Re: opApply Magic Function Body Transformation

2025-07-28 Thread kinke via Digitalmars-d-learn
On Monday, 28 July 2025 at 14:28:57 UTC, Mike Shah wrote: Is there somewhere already in LDC2 where I can dump out the generated transformation (Otherwise I can probably read the IR well enough)? Yeah I'm afraid the IR is probably the best source. LDC's `-vv` verbose codegen output would show

Re: opApply Magic Function Body Transformation

2025-07-28 Thread kinke via Digitalmars-d-learn
On Monday, 28 July 2025 at 04:39:00 UTC, Mike Shah wrote: **So really my one concrete question is** -- can I see main.main()__foreachbody_L21_C3(ref int) anywhere? I think that's where the confusion comes from, that misleading `-vcg-ast` output for the loop-body-lambda, apparently printed as

Re: extern(C) on var decl is confusing

2025-07-28 Thread kinke via Digitalmars-d-learn
On Sunday, 27 July 2025 at 23:23:40 UTC, user1234 wrote: That is confusing It affects the mangling of global vars, just like functions.

Re: shared library, function arguments order reversed?

2025-05-21 Thread kinke via Digitalmars-d-learn
On Wednesday, 21 May 2025 at 08:09:23 UTC, xoxo wrote: auto fn_test = cast(void function(int, int)) dlsym(lib, "test"); This is the problem - you're casting the address to an `extern(D)` function pointer. Use something like this: ``` alias Fn = extern(C) void function(int, int); auto fn_test

Re: Linking objects built with MingW on windows

2025-04-10 Thread kinke via Digitalmars-d-learn
MinGW isn't supported by DMD and LDC. If you can't use an MS Visual C++ toolchain to build that webview.obj (and all libs it depends on), you could give GDC a try.

Re: `ld.lld: error: undefined symbol: __tls_get_addr' when trying to use ldc2 to compile to android24 target

2024-11-27 Thread kinke via Digitalmars-d-learn
On Wednesday, 27 November 2024 at 11:50:29 UTC, TheZipCreator wrote: Compiling with `--emulated-tls` (and `-Xcc=-femulate-tls`) doesn't seem to fix it. I'm using `android-ndk-r27/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android24-clang` as my compiler. Running it with android 30 w

Re: LDC cant find lld-link when crosscompiling

2024-10-10 Thread kinke via Digitalmars-d-learn
On Wednesday, 9 October 2024 at 16:07:29 UTC, AzuraAkumore wrote: I installed both LDC and DMD via the deb package files. And that's the problem - that deb package apparently wasn't built with the LLD linker integration. Official LDC releases from GitHub are, and thus default to `-link-intern

Re: Build fully static library by the compiler?

2024-08-11 Thread kinke via Digitalmars-d-learn
On Sunday, 11 August 2024 at 13:16:16 UTC, Denis Feklushkin wrote: What you could e.g. do with a dedicated ldc2.conf is specifying the paths to druntime and Phobos as regular default switches. This will break a lot of things, it's easier to manually add a similar hack into the build scripts

Re: Build fully static library by the compiler?

2024-08-11 Thread kinke via Digitalmars-d-learn
On Sunday, 11 August 2024 at 11:08:24 UTC, Denis Feklushkin wrote: Similar to how people can avoid explicitly linking GNU's libstdc++ / LLVM's libc++ by using `c++` instead of `cc` as linker driver, thereby not having to know which implementation of the C++ std library to choose for the particu

Re: Build fully static library by the compiler?

2024-08-11 Thread kinke via Digitalmars-d-learn
On Friday, 9 August 2024 at 02:34:03 UTC, Denis Feklushkin wrote: Are there simple way to make a static library that also includes necessary standard D libraries (i.e., phobos2 and druntime)? Nope, you'd have to specify the path to the libs explicitly in the cmdline to merge them into the cre

Re: Hidden members of Class objects

2024-03-06 Thread kinke via Digitalmars-d-learn
On Thursday, 7 March 2024 at 00:28:17 UTC, Carl Sturtivant wrote: On Wednesday, 6 March 2024 at 23:45:00 UTC, H. S. Teoh wrote: In D, there's a pointer to the vtable and another pointer to a Monitor object (used for synchronized methods). There was talk about getting rid of the Monitor field y

Re: Why does disabling a struct's postblit increase its size in memory?

2024-03-02 Thread kinke via Digitalmars-d-learn
On Saturday, 2 March 2024 at 15:25:48 UTC, Per Nordlöw wrote: Why does disabling a struct's postblit increase its sizeof by one word? The following holds: ```d struct S { @disable this(this); int _; } struct T { int _; } static assert(S.sizeof == 16); static assert(T.sizeof == int.sizeof); ```

Re: Compile-time predicate for checking whether an aggregate field is static

2024-03-02 Thread kinke via Digitalmars-d-learn
On Saturday, 2 March 2024 at 15:22:03 UTC, Per Nordlöw wrote: How do I at compile-time check whether an aggregate field is static? https://dlang.org/phobos/std_traits.html#hasStaticMember perhaps.

Re: Inlined functions and their original bodies - bloat

2023-07-10 Thread kinke via Digitalmars-d-learn
The 'bloat' is usually gotten rid of by the linker if really unreferenced in the binary being linked. There's a little trick to make sure the function is *always* inlined, across modules too, allowing to suppress the then guaranteed unused function symbol - converting it to a function literal

Re: Getting the default value of a class member field

2022-12-01 Thread kinke via Digitalmars-d-learn
You could potentially skip running the `@constructValue` lambdas in the ctor via `if (__ctfe)`, if skipping this extra init is acceptable for CTFE instances.

Re: Getting the default value of a class member field

2022-12-01 Thread kinke via Digitalmars-d-learn
On Friday, 2 December 2022 at 04:14:37 UTC, kinke wrote: [...] Such an instance should be CTFE-constructible, and the valid instance would feature the expected value for the `validUntil` field. [...] Oh well, that time-sensitive example clearly isn't CTFE-able. :D - If that's the primary use

Re: Getting the default value of a class member field

2022-12-01 Thread kinke via Digitalmars-d-learn
On Friday, 2 December 2022 at 00:24:44 UTC, WebFreak001 wrote: I want to use the static initializers (when used with an UDA) as default values inside my SQL database. See https://github.com/rorm-orm/dorm/blob/a86c7856e71bbc18cd50a7a6f701c325a4746518/source/dorm/declarative/conversion.d#L959

Re: Getting the default value of a class member field

2022-12-01 Thread kinke via Digitalmars-d-learn
On Thursday, 1 December 2022 at 08:09:05 UTC, WebFreak001 wrote: I've got this class definition: ```d class X { this() { assert(false); } int x = 3; } ``` due to internal reasons the constructor would fail at compile time, so I put in an assert(false) here, and I can't

Re: pragma(linkerDirective,_) removes double quotes, dmd ignores LIB

2022-11-27 Thread kinke via Digitalmars-d-learn
For LDC, you shouldn't need any double quotes, the compiler quotes the linker flag if it contains spaces.

Re: dub ldc2 static linking

2022-10-27 Thread kinke via Digitalmars-d-learn
For fully static linking on Linux, you'll need to move away from glibc to e.g. the musl C runtime, as used by the Alpine distro.

Re: "Error: no property `offsetof` for type `char*`"

2022-08-19 Thread kinke via Digitalmars-d-learn
On Friday, 19 August 2022 at 13:49:08 UTC, MyNameHere wrote: Thank you, that seems to have resolved the issue, though I wish these sorts of problems would stop cropping up, they are souring the experience with the language. Oh and `DevicePath()` is a convenience member returning a pointer to

Re: "Error: no property `offsetof` for type `char*`"

2022-08-19 Thread kinke via Digitalmars-d-learn
On Friday, 19 August 2022 at 14:22:04 UTC, Steven Schveighoffer wrote: On 8/19/22 9:49 AM, MyNameHere wrote: Thank you, that seems to have resolved the issue, though I wish these sorts of problems would stop cropping up, they are souring the experience with the language. Most likely that "mem

Re: "Error: no property `offsetof` for type `char*`"

2022-08-19 Thread kinke via Digitalmars-d-learn
It's a method returning a `CHAR*` - `_DevicePath` is the actual member. I guess it's a dynamically sized struct, which cannot be mapped directly to D, hence this representation.

Re: How to call a function from a dll created with d ?

2022-07-03 Thread kinke via Digitalmars-d-learn
On Sunday, 3 July 2022 at 08:15:38 UTC, frame wrote: Are you sure? 100%, just try yourself. You import `testFunc` as normal import, the compiler ignores `pragma(lib)` - that's only for the linker which will ignore it too since the symbol is already in your executable. Why would the symbol

Re: How to call a function from a dll created with d ?

2022-07-02 Thread kinke via Digitalmars-d-learn
With LDC, this is sufficient for this trivial example: ```d module dimedll; export void testFunc() { // export only needed when compiling with `-fvisibility=hidden` import std.stdio; writeln("This is from dll"); } ``` `ldc2 -shared dimedll.d` generates import lib + DLL. ```d import d

Re: D WebAssembly working differently than C++, Zig

2022-05-16 Thread kinke via Digitalmars-d-learn
The problem is the memset signature. You assume the length is the number of floats, while it's the number of *bytes* to be set to the specified value. https://en.cppreference.com/w/c/string/byte/memset

Re: Crosscompiling LDC's druntime for Android on Windows

2022-02-21 Thread kinke via Digitalmars-d-learn
On Monday, 21 February 2022 at 00:24:54 UTC, Fry wrote: I'm following the azure pipeline's commands for how it's being built here: https://github.com/ldc-developers/ldc/blob/master/.azure-pipelines/2-posix-build_cross_android.yml#L64 You can check the CI logs for the expanded cmdlines, e.g., f

Re: Does anyone build for Android? Tons of link errors..

2022-02-18 Thread kinke via Digitalmars-d-learn
On Friday, 18 February 2022 at 16:28:56 UTC, Fry wrote: Does anyone know why the bfd linker is needed and why the gold linker doesn't work for the emulated TLS? It's required for LDC's custom TLS emulation for Android, see 1st point in https://wiki.dlang.org/Build_D_for_Android#Directions_for

Re: Does anyone build for Android? Tons of link errors..

2022-02-16 Thread kinke via Digitalmars-d-learn
On Wednesday, 16 February 2022 at 20:40:02 UTC, Fry wrote: A lot of unresolved references to just CPU_COUNT. The confusing part is that it has undefined referenced to parts of in `core`, which I am linking the druntime as well. If you're linking manually, make sure that `-ldruntime-ldc` comes

Re: Cross Compile to Linux from Windows using LDC?

2022-02-10 Thread kinke via Digitalmars-d-learn
On Thursday, 10 February 2022 at 16:52:32 UTC, H. S. Teoh wrote: If I understand it right, you ought to be able to do the same thing on Windows [...] Not quite; cross-compiling to Windows has been made especially simple and is a special case. When cross-compiling from Windows to Linux, this a

Re: Can anyone provide an example of how D templates are overridable by global symbols?

2022-01-27 Thread kinke via Digitalmars-d-learn
An example: a.d: ``` import core.stdc.stdio; void foo()() { version (Oops) printf(" foo - oops\n"); else printf(" foo\n"); } void doA() { printf("doA:\n"); foo!(); } ``` b.d: ``` import core.stdc.stdio; import a; void main() { printf("main:\n"); foo!(

Re: ldc2 failed with exit code -1073741819.

2022-01-18 Thread kinke via Digitalmars-d-learn
On Tuesday, 18 January 2022 at 16:25:45 UTC, Anonymouse wrote: What can I *reasonably* do here? Do I *have* to compile LDC from source, to get debug symbols? How else can I reduce it when it doesn't say what goes wrong? [-1073741819 == 0xc005 => access violation] Some options: 1. This mi

Re: How to deploy single exe application (?)

2021-11-28 Thread kinke via Digitalmars-d-learn
On Monday, 29 November 2021 at 03:59:11 UTC, kinke wrote: `ldc\curl.exp` Typo, should have been `lib\curl.exp`.

Re: How to deploy single exe application (?)

2021-11-28 Thread kinke via Digitalmars-d-learn
On Sunday, 28 November 2021 at 16:08:20 UTC, Willem wrote: Is it possible to distribute an .exe file without the required libcurl DLL? LDC ships with a static curl library - `lib\curl_a.lib`. IIRC, you'll also need to export the curl symbols from the .exe for std.net.curl consumption, by addi

Re: AVX for math code ... avx instructions later disappearing ?

2021-09-26 Thread kinke via Digitalmars-d-learn
On Sunday, 26 September 2021 at 18:08:46 UTC, james.p.leblanc wrote: or even moving the array declarations to before the dot product function, and the avx instructions will disappear! That's because the `@fastmath` UDA applies to the next declaration only, which is the `x` array in your 2nd e

Re: LDC 1.28.0-beta1

2021-09-25 Thread kinke via Digitalmars-d-learn
Argh, wrong forum section, proper (identical) post: https://forum.dlang.org/thread/hcwukzoamezbpzrbk...@forum.dlang.org

LDC 1.28.0-beta1

2021-09-25 Thread kinke via Digitalmars-d-learn
Glad to announce the first beta for LDC 1.28 - some highlights: * Based on D 2.098.0-beta.2+ (today's stable). * Dynamic casts across binary boundaries (DLLs etc.) now work. * Windows: `-dllimport=defaultLibsOnly` doesn't require `-linkonce-templates` anymore. Full release log and downloads:

Re: Cannot catch exception in debug mode

2021-08-11 Thread kinke via Digitalmars-d-learn
On Thursday, 12 August 2021 at 02:03:39 UTC, Adam D Ruppe wrote: On Thursday, 12 August 2021 at 01:53:12 UTC, frame wrote: Is this a known DMD bug or feature? Huh that is weird, it works correctly in gdc but i can reproduce in dmd and ldc. And removing the debug keyword makes it work. Certai

Re: align dynamic array (for avx friendliness) hints? / possible??

2021-08-03 Thread kinke via Digitalmars-d-learn
On Tuesday, 3 August 2021 at 12:33:56 UTC, james.p.leblanc wrote: Concise question: = I would like to use dynamic arrays, not for their dynamic sizing properties per se' (slicing, appending, etc). But, more for their memory protection and efficiencies (for example,using foreach).

Re: Why are class methods not allowed to call cons/destructors?

2021-07-31 Thread kinke via Digitalmars-d-learn
On Saturday, 31 July 2021 at 13:59:46 UTC, Tejas wrote: On Saturday, 31 July 2021 at 13:57:40 UTC, kinke wrote: This is possible via: ``` __dtor(); super.__dtor(); ``` WHOO YEAH!!! THANK YOU SO MUCH :D Heh you're welcome. Note that you'll probably want `__xdtor()`, which also destructs fiel

Re: Why are class methods not allowed to call cons/destructors?

2021-07-31 Thread kinke via Digitalmars-d-learn
This is possible via: ``` __dtor(); super.__dtor(); ```

Re: LLVM asm with constraints, and 2 operands

2021-07-19 Thread kinke via Digitalmars-d-learn
On Monday, 19 July 2021 at 17:20:21 UTC, kinke wrote: Compiling with `-O -mtriple=i686-linux-gnu -mcpu=i686` (=> no SSE2 by default) shows that the inlined version inside `wrapper()` is the mega slow one, so the extra instructions aren't applied transitively unfortunately. Erm sorry should ha

Re: LLVM asm with constraints, and 2 operands

2021-07-19 Thread kinke via Digitalmars-d-learn
On Monday, 19 July 2021 at 16:44:35 UTC, Guillaume Piolat wrote: On Monday, 19 July 2021 at 10:49:56 UTC, kinke wrote: This workaround is actually missing the clobber constraint for `%2`, which might be problematic after inlining. An unrelated other issue with asm/__asm is that it doesn't f

Re: LLVM asm with constraints, and 2 operands

2021-07-19 Thread kinke via Digitalmars-d-learn
On Monday, 19 July 2021 at 11:39:02 UTC, Basile B. wrote: And what about the `extern(C)` issue ? Does it make sense to be used when the parameters are int4 ? The original inline asm was buggy and only 'worked' by accident (not using the 2nd input operand at all...) with extern(D) reversed par

Re: LLVM asm with constraints, and 2 operands

2021-07-19 Thread kinke via Digitalmars-d-learn
On Monday, 19 July 2021 at 11:16:49 UTC, Tejas wrote: On Monday, 19 July 2021 at 10:49:56 UTC, kinke wrote: On[snip] Is LDC still compatible with GDC/GCC inline asm? I remember Johan saying they will break compatibilty in the near future... I'm not aware of any of that; who'd be 'they'? GCC

Re: LLVM asm with constraints, and 2 operands

2021-07-19 Thread kinke via Digitalmars-d-learn
On Monday, 19 July 2021 at 10:21:58 UTC, kinke wrote: What works reliably is a manual mov: ``` int4 _mm_add_int4(int4 a, int4 b) { int4 r; asm { "paddd %1, %2; movdqa %2, %0" : "=x" (r) : "x" (a), "x" (b); } return r; } ``` This workaround is actually missing the clobber constrai

Re: LLVM asm with constraints, and 2 operands

2021-07-19 Thread kinke via Digitalmars-d-learn
On Sunday, 18 July 2021 at 16:32:46 UTC, Basile B. wrote: - **=x** says "returns in whatever is has to" - **x** (1) is the constraint for input `a`, which is passed as operand **$0** - **x** (2) is the constraint for input `b`, which is passed as operand **$1** $0 is actually the output opera

Re: Are D classes proper reference types?

2021-06-27 Thread kinke via Digitalmars-d-learn
On Sunday, 27 June 2021 at 12:00:41 UTC, Ola Fosheim Grøstad wrote: On Sunday, 27 June 2021 at 10:11:44 UTC, kinke wrote: Right, but what does all supported C++ runtimes mean? I thought LDC was tied to clang, which I guess means two runtimes? If C++ doesn't use arbitrary negative offsets, then

Re: Are D classes proper reference types?

2021-06-27 Thread kinke via Digitalmars-d-learn
On Sunday, 27 June 2021 at 09:46:45 UTC, Ola Fosheim Grøstad wrote: On Sunday, 27 June 2021 at 08:41:27 UTC, kinke wrote: Getting rid of the monitor field was discussed multiple times. You don't have to get rid of it, just implicitly declare it for classes that use monitors? I don't think it

Re: Are D classes proper reference types?

2021-06-27 Thread kinke via Digitalmars-d-learn
On Sunday, 27 June 2021 at 07:54:38 UTC, Ola Fosheim Grøstad wrote: That is all good, but it will lead to `extern(C++) class` replacing D classes. So why not unify right away? Why wait for the inevitable? The assumption that all D code and all classes therein are or need to be designed for C+

Re: Are D classes proper reference types?

2021-06-26 Thread kinke via Digitalmars-d-learn
On Saturday, 26 June 2021 at 20:03:01 UTC, kinke wrote: With C++, you can today, an `extern(C++) class C` is equivalent to and mangled as C++ `C*`. You can't pass it directly to some `unique_ptr` or `shared_ptr` of course; an according D wrapper reflecting the C++ implementation (library-depend

Re: Are D classes proper reference types?

2021-06-26 Thread kinke via Digitalmars-d-learn
On Saturday, 26 June 2021 at 13:49:25 UTC, Ola Fosheim Grøstad wrote: Is it possible to inherit from a C++ class and get a D subclass, and is it possible to inherit from a D class and get a C++ class? Sure thing, with `extern(C++) class` of course. But the best solution is to get to a place w

Re: Are D classes proper reference types?

2021-06-26 Thread kinke via Digitalmars-d-learn
On Saturday, 26 June 2021 at 07:00:37 UTC, Ola Fosheim Grøstad wrote: Weak pointers aren't in the language, so I don't see why they would matter here. I thought you were after replacing GC-allocated class instances by a simple RC scheme. One goal could be to make a class compatible with C++ or

Re: Are D classes proper reference types?

2021-06-25 Thread kinke via Digitalmars-d-learn
On Friday, 25 June 2021 at 17:05:41 UTC, Ola Fosheim Grøstad wrote: Yes, if you don't want to support weak pointers. I think you need two counters if you want to enable the usage of weak pointers. I cannot imagine how weak pointers would work without an ugly extra indirection layer. If we're

Re: Are D classes proper reference types?

2021-06-25 Thread kinke via Digitalmars-d-learn
Wrt. manual non-heap allocations (stack/data segment/emplace etc.), you could e.g. reserve the most significant bit of the counter to denote such instances and prevent them from being free'd (and possibly finalization/destruction too; this would need some more thought I suppose).

Re: Are D classes proper reference types?

2021-06-25 Thread kinke via Digitalmars-d-learn
On Friday, 25 June 2021 at 06:09:17 UTC, Ola Fosheim Grøstad wrote: On Thursday, 24 June 2021 at 07:28:56 UTC, kinke wrote: Yes, class *refs* are always pointers. *scope* classes are deprecated (I don't think I've ever seen one); with `scope c = new Object`, you can have the compiler allocate a

Re: Are D classes proper reference types?

2021-06-24 Thread kinke via Digitalmars-d-learn
On Thursday, 24 June 2021 at 12:31:08 UTC, Stefan Koch wrote: On Thursday, 24 June 2021 at 07:28:56 UTC, kinke wrote: On Thursday, 24 June 2021 at 06:50:44 UTC, Ola Fosheim Grøstad wrote: [...] (I don't think I've ever seen one); with `scope c = new Object`, you can have the compiler allocat

Re: Are D classes proper reference types?

2021-06-24 Thread kinke via Digitalmars-d-learn
On Thursday, 24 June 2021 at 06:50:44 UTC, Ola Fosheim Grøstad wrote: [...] Yes, class *refs* are always pointers. *scope* classes are deprecated (I don't think I've ever seen one); with `scope c = new Object`, you can have the compiler allocate a class *instance* on the stack for you, but `

Re: LNK2019 error in the C++ interface

2021-06-10 Thread kinke via Digitalmars-d-learn
On Thursday, 10 June 2021 at 13:19:34 UTC, dokutoku wrote: The reason seems to be that WCHAR should be mangled with wcha_t, but it is mangled with chat16_t. Confirmed: https://issues.dlang.org/show_bug.cgi?id=22014 Wrt. `tagRECT`, this should come in handy (for a druntime fix): https://dlang.

Re: Shift operator, unexpected result

2021-06-09 Thread kinke via Digitalmars-d-learn
On Wednesday, 9 June 2021 at 19:13:10 UTC, JG wrote: I found the following behaviour, as part of a more complicated algorithm, unexpected. The program: import std; void main() { int n = 64; writeln(123uL>>n); } produces: 123 I would expect 0. What is the rati

Re: How to compile Phobos with other D code to create a shared library?

2021-05-31 Thread kinke via Digitalmars-d-learn
On Monday, 31 May 2021 at 19:21:52 UTC, data pulverizer wrote: ldc2 jbasic.d -O3 -link-defaultlib-shared --betterC --boundscheck=off -nogc -shared -of=jbasic.so The problem is almost certainly `-betterC`, which disables linking against Phobos and druntime.

Re: isPOD is broken?

2021-03-26 Thread kinke via Digitalmars-d-learn
A class *reference* is always a POD. Only structs can be non-PODs.

Re: dmd -> ldmd2: /usr/bin/ld.gold: error: .o: multiple definition of 'bool ldc.attributes...

2021-03-07 Thread kinke via Digitalmars-d-learn
On Sunday, 7 March 2021 at 11:34:08 UTC, kdevel wrote: ./dmd -i -I=tillyscop:tillyscop/msgpack-d/src -O -g -of=localscop.o -c tillyscop/scop.d tillyscop/scopserializer.d and ./dmd -i -of=pointless.o -g -c pointless/package.d "dmd" is a symlink to /opt/ldc2/bin/ldmd2 Ah, try using `-i=-ldc`

Re: Using YMM registers causes an undefined label error

2021-03-06 Thread kinke via Digitalmars-d-learn
On Saturday, 6 March 2021 at 12:29:07 UTC, kinke wrote: There are other slight breakages of that 'spec', e.g., LDC's extern(D) ABI is very similar to Microsoft's __vectorcall (so that e.g. vectors are passed in registers). [Windows only, to prevent any more confusion.]

Re: Using YMM registers causes an undefined label error

2021-03-06 Thread kinke via Digitalmars-d-learn
On Saturday, 6 March 2021 at 12:15:43 UTC, Mike Parker wrote: On Saturday, 6 March 2021 at 11:57:13 UTC, Imperatorn wrote: What... Is this really how it's supposed to be? Makes no sense to not use any of the existing conventions. extern(C) and extern(D) are both documented to be the same as

Re: Using YMM registers causes an undefined label error

2021-03-06 Thread kinke via Digitalmars-d-learn
On Friday, 5 March 2021 at 12:57:43 UTC, z wrote: XMM registers work, but as soon as they are changed into YMM DMD outputs "bad type/size of operands %s" and LDC outputs an "label YMM0 is undefined" error. Are they not supported? To illutrate : https://run.dlang.io/is/IqDHlK LDC's support for

Re: dub support for Mac M1?

2021-03-04 Thread kinke via Digitalmars-d-learn
On Thursday, 4 March 2021 at 22:30:17 UTC, tastyminerals wrote: I got a company MacBook with M1 chip and gradually migrate all the stuff from Linux machine. I got precompiled ldc binary installed without any problem now is the time for dub since I have couple of D projects I use at work and all

Re: Class instance alignment

2021-02-22 Thread kinke via Digitalmars-d-learn
On Monday, 22 February 2021 at 02:23:27 UTC, Steven Schveighoffer wrote: Hm... but does TypeInfo detail alignment? Apparently not for TypeInfo_Class; .talign() returns the alignment of a class *ref*, i.e., pointer size. TypeInfo_Struct.talign() does return the struct alignment though and cou

Re: Class instance alignment

2021-02-20 Thread kinke via Digitalmars-d-learn
On Saturday, 20 February 2021 at 18:43:53 UTC, Steven Schveighoffer wrote: Last I checked*, the GC uses pools of 16-byte, 32-byte, 64-byte, etc blocks. That has changed [to reduce wastage]; the new bin sizes are here and include sizes like 176 (11*16): https://github.com/dlang/druntime/blob/7

Re: Class instance alignment

2021-02-19 Thread kinke via Digitalmars-d-learn
On Friday, 19 February 2021 at 23:53:55 UTC, tsbockman wrote: How can I get the alignment of a class instance? I know how to get the size: __traits(classInstanceSize, T) But, there doesn't appear to be any equivalent trait for the alignment. There's https://github.com/dlang/druntime/blob

Re: Struct delegate access corruption

2021-02-18 Thread kinke via Digitalmars-d-learn
On Wednesday, 17 February 2021 at 20:44:46 UTC, tsbockman wrote: On Wednesday, 17 February 2021 at 20:18:53 UTC, Paul Backus wrote: On Wednesday, 17 February 2021 at 19:42:00 UTC, tsbockman wrote: A copy constructor and opAssign can be used to update pointers that are relative to &this: ht

Re: Wrapping C++ class with virtual destructor

2021-02-17 Thread kinke via Digitalmars-d-learn
On Wednesday, 17 February 2021 at 22:53:05 UTC, Gregor Mückl wrote: Hi! How do I wrap an existing C++ class with a virtual destructor in D? Take, for example, this C++ class: class Base { public: virtual ~Base(); virtual void foo() = 0; } What does the equivalent extern(C++) declara

Re: Real simple unresolved external symbols question...

2021-02-10 Thread kinke via Digitalmars-d-learn
On Thursday, 11 February 2021 at 00:18:23 UTC, H. S. Teoh wrote: On Wed, Feb 10, 2021 at 11:35:27PM +, WhatMeWorry via Digitalmars-d-learn wrote: [...] Okay, thanks. Then why does the README.md at https://github.com/dlang/druntime say "Runtime is typically linked together with Phobos in a

Re: Real simple unresolved external symbols question...

2021-02-10 Thread kinke via Digitalmars-d-learn
On Tuesday, 9 February 2021 at 19:37:17 UTC, WhatMeWorry wrote: I'm trying to create a super simple dynamic library consisting of two files: file2.d -- extern(D): double addEight(double d) { return (d + 8.0); } fileB.d -

Re: emplace doesn't forward aeguments

2021-02-01 Thread kinke via Digitalmars-d-learn
On Saturday, 30 January 2021 at 17:29:15 UTC, vitamin wrote: On Thursday, 28 January 2021 at 23:18:21 UTC, kinke wrote: On Thursday, 28 January 2021 at 21:15:49 UTC, vitamin wrote: Is there reason why std.conv.emplace doesn't forward arguments to __ctor? Yeah, a bug in the emplace() version f

Re: emplace doesn't forward aeguments

2021-01-28 Thread kinke via Digitalmars-d-learn
On Thursday, 28 January 2021 at 21:15:49 UTC, vitamin wrote: Is there reason why std.conv.emplace doesn't forward arguments to __ctor? Yeah, a bug in the emplace() version for classes, some missing `forward!args` in there (it works when emplacing a struct with identical ctor). E.g. https://g

Re: 64-bit compilation in Wine

2020-12-30 Thread kinke via Digitalmars-d-learn
On Tuesday, 29 December 2020 at 21:13:59 UTC, Raikia wrote: That certainly helped, but when running the program on a fresh Windows install, I still get the error "The program can't start because vcruntime140.dll is missing from your computer". In my (limited) experience, I think its because it

Re: d++: Error: Could not execute `dmd c.o .\foo.d -offoo.exe`:

2020-11-21 Thread kinke via Digitalmars-d-learn
On Saturday, 21 November 2020 at 17:25:46 UTC, Jack wrote: I got the error: Error: Could not execute `dmd c.o .\foo.d -offoo.exe`: Error: unrecognized file extension o dmd version: DMD32 D Compiler v2.094.1-dirty gcc version: gcc version 6.3.0 (MinGW.org GCC-6.3.0-1) DMD expects .obj fo

Re: rt/object.d

2020-10-29 Thread kinke via Digitalmars-d-learn
On Thursday, 29 October 2020 at 16:02:34 UTC, Ola Fosheim Grøstad wrote: I meant the internals like vtable/typeinfo. https://dlang.org/spec/abi.html#classes

Re: Passing pointer to extern(C++) templated function

2020-10-13 Thread kinke via Digitalmars-d-learn
On Wednesday, 14 October 2020 at 00:25:56 UTC, Jamie wrote: Happy to file a bug, but if it was a bug in the mangler wouldn't both C++ and D get the same result? Assuming D uses the same mangler for the extern(C++) stuff. Bug in the D frontend implementation of Itanium C++ mangling. https://gi

Re: Passing pointer to extern(C++) templated function

2020-10-13 Thread kinke via Digitalmars-d-learn
On Tuesday, 13 October 2020 at 09:23:48 UTC, Jamie wrote: It appears that func3 and func4 take on different types depending on other variables being present? Is this expected? Nope, it's a bug in the Itanium C++ mangler, please file a bug. MSVC++ mangling seems fine, after fixing the D declara

Re: Link Time Optimization Bitcode File Format

2020-10-06 Thread kinke via Digitalmars-d-learn
On Tuesday, 6 October 2020 at 16:46:28 UTC, Severin Teona wrote: Also, when I try to link the druntime with the application I want to write on the microcontroller, there are some link errors due to the file format. This happens when you link manually, not through LDC. When running LDC with `-

Re: Trying to create a trivial 64 bit D Lang DLL on a Windows 10 machine and cant get past linking.

2020-10-01 Thread kinke via Digitalmars-d-learn
On Thursday, 1 October 2020 at 20:03:19 UTC, WhatMeWorry wrote: Yes, but shouldn't the /NOENTRY option take care of that. Say, I just want to make a DLL of simple functions. Your little example has 2 problems, the first being an incompatible extern(D) ex/import (mydll.myAddSeven vs. user.myAd

Re: How to implement fastcall ?

2020-09-23 Thread kinke via Digitalmars-d-learn
On Wednesday, 23 September 2020 at 19:50:13 UTC, Denis Feklushkin wrote: On Monday, 21 September 2020 at 11:14:06 UTC, Виталий Фадеев wrote: How to implement fastcall ? ( stdcall is calling convention for pass function arguments via registers ) Hypothesis: it is possible what LLVM + Link Time

Re: Trouble with Android and arsd.jni

2020-09-10 Thread kinke via Digitalmars-d-learn
On Thursday, 10 September 2020 at 13:14:00 UTC, burt wrote: However, the app is still crashing when I load it, and there appears to be an issue in Runtime.initialize(), which is called from JNI_OnLoad(), which is defined in arsd.jni. The debugger tells me that it was calling `getStaticTLSRange`

Re: Trouble with Android and arsd.jni

2020-09-10 Thread kinke via Digitalmars-d-learn
On Thursday, 10 September 2020 at 11:16:55 UTC, burt wrote: However, I am getting linker errors, telling me that _tlsend, _tlsstart and __bss_end__ are missing. Perhaps you happen to use some stale artifacts? These magic symbols aren't used anymore in druntime since LDC v1.21, and not defined

Re: GC.LDC2 on Android

2020-09-08 Thread kinke via Digitalmars-d-learn
On Tuesday, 8 September 2020 at 12:47:11 UTC, Danny Arends wrote: How can I figure out which linker is used ? When performing a dub build, it just mentions that ldc2 is used for linking You can add -v as dub 'linker' flag, that will make LDC show the actual cmdline. LDC v1.23 defaults to `-lin

Re: GC.LDC2 on Android

2020-09-08 Thread kinke via Digitalmars-d-learn
On Tuesday, 8 September 2020 at 11:17:45 UTC, Danny Arends wrote: Does anyone have any experience with using D on android, and using the garbage collector ??? I've never run anything on Android myself, but I've gotten good feedback on AArch64 at least. Make sure to use a recent LDC, and espec

Re: Building LDC runtime for a microcontroller

2020-09-07 Thread kinke via Digitalmars-d-learn
On Monday, 7 September 2020 at 15:23:28 UTC, Severin Teona wrote: CMake Error at /snap/cmake/549/share/cmake-3.18/Modules/CMakeTestCCompiler.cmake:66 (message): This is apparently a non-LDC specific issue, a default CMake C compiler sanity check fails. When looking at that file, you'll see th

Re: How to define delegate what returns ref?

2020-08-28 Thread kinke via Digitalmars-d-learn
On Friday, 28 August 2020 at 11:46:15 UTC, Oleg B wrote: How to do this more clearly? alias Dg = ref int delegate(); Dg foo;

Re: BetterC + WASM Update

2020-08-19 Thread kinke via Digitalmars-d-learn
On Wednesday, 19 August 2020 at 21:24:23 UTC, Mike Brown wrote: I have done some tests, and it appears that classes are supported (LDC 1.22.0)? extern(C++) classes are supported by -betterC. With LDC, D classes are supported to some extent too since v1.11, but this requires a custom object.d

Re: LDC cross-module-inlining

2020-08-10 Thread kinke via Digitalmars-d-learn
On Monday, 10 August 2020 at 11:11:57 UTC, Per Nordlöw wrote: Are the official LDC-releases builtin with or without LTO? Most of them are, but not sure why that matters here (the gain is almost negligible and mainly interesting for the C++ parts - as all D files are compiled to a single objec

Re: __vector(ubyte[32]) misalignment

2020-08-09 Thread kinke via Digitalmars-d-learn
On Sunday, 9 August 2020 at 01:03:51 UTC, Bruce Carneal wrote: Is sub .alignof alignment expected here? IOW, do I have to manually manage memory if I want alignments above 16? IIRC, yes when using the GC, as that only guarantees 16-bytes alignment. Static arrays on the stack should be aligned

Re: Forcing inline functions (again) - groan

2020-07-15 Thread kinke via Digitalmars-d-learn
On Wednesday, 15 July 2020 at 13:38:34 UTC, Cecil Ward wrote: I recently noticed pragma(inline, true) which looks extremely useful. A couple of questions : 1. Is this cross-compiler compatible? Works for LDC and DMD, not sure about GDC, but if it doesn't support it, it's definitely on Iai

Re: Choosing a non-default linker for dmd (via dub)

2020-07-15 Thread kinke via Digitalmars-d-learn
On Wednesday, 15 July 2020 at 11:38:47 UTC, Jacob Carlborg wrote: There's an environment variable "CC" that can be used to select which C compiler is used. Is there any equivalence for selecting the linker, "LD" perhaps? You normally just add -fuse-ld=gold to the C compiler cmdline, e.g., via

Re: BetterC Bug? Intended Behavior? Asking Here As Unsure

2020-07-06 Thread kinke via Digitalmars-d-learn
On Monday, 6 July 2020 at 22:02:37 UTC, Kayomn wrote: On Monday, 6 July 2020 at 21:09:57 UTC, kinke wrote: Similar case here; the 'varargs' end up in a GC-allocated array. I've recently changed `scope` slice params, so that array literal arguments are allocated on the caller's stack instead; s

Re: BetterC Bug? Intended Behavior? Asking Here As Unsure

2020-07-06 Thread kinke via Digitalmars-d-learn
On Monday, 6 July 2020 at 20:25:11 UTC, Kayomn wrote: Though, admittedly I'm kind of used to seeing this error message since it appears any time you try and do something that relies on type info in betterC, intentionally or not. A notable example is forgetting to supply an arrange length when

Re: Catching OS Exceptions in Windows using LDC

2020-07-04 Thread kinke via Digitalmars-d-learn
On Saturday, 4 July 2020 at 12:59:03 UTC, Adam D. Ruppe wrote: For whatever reason, dmd 64 bit and ldc decided to do their own thing instead of following the Windows standard and thus have no interop with OS exceptions. For LDC, we don't do 'our own thing', but use MSVC++ EH, which allows to

Re: Generating struct .init at run time?

2020-07-02 Thread kinke via Digitalmars-d-learn
On Thursday, 2 July 2020 at 16:51:52 UTC, kinke wrote: `= void` for members doesn't work and, I dare say, not work anytime soon if ever. I've quickly checked; `= void` for members has initialize-with-zeros semantics too, so with LDC, it's equivalent to `= 0` but applicable to user-defined typ

Re: Generating struct .init at run time?

2020-07-02 Thread kinke via Digitalmars-d-learn
On Thursday, 2 July 2020 at 15:20:23 UTC, Ali Çehreli wrote: According to its date, it was written when I was working for Weka. Apparently, ldc took care of it for them after all. If so, then without them posting any issue beforehand or giving any feedback afterwards. > For recent LDC versi

  1   2   3   4   >