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

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

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.

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

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

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

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

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

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'?

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

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

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

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

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

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++

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

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

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):

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

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

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

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

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):

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

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 :

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++)

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

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.

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

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

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.

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

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.

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

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

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

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

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

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

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

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

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

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.,

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;

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

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

Re: Generating struct .init at run time?

2020-07-02 Thread kinke via Digitalmars-d-learn
On Thursday, 2 July 2020 at 07:51:29 UTC, Ali Çehreli wrote: Of course, the solution is to define members with '= void' Since when? https://issues.dlang.org/show_bug.cgi?id=11331 and your https://issues.dlang.org/show_bug.cgi?id=16956 are still open. For recent LDC versions, the 'solution'

Re: Linking D with C structs

2020-06-29 Thread kinke via Digitalmars-d-learn
On Monday, 29 June 2020 at 06:29:38 UTC, Anthony wrote: What does "__initZ" refer to? Does this refer to automatic initialization like "this()"? Almost, it's the static initializer for that struct, which is omitted because you apparently don't compile/link the module containing the struct

Re: Garbage collection

2020-06-27 Thread kinke via Digitalmars-d-learn
On Saturday, 27 June 2020 at 15:27:34 UTC, Stanislav Blinov wrote: On Saturday, 27 June 2020 at 14:12:09 UTC, kinke wrote: Note that I explicitly clear the `str` slice before GC.collect(), so that the stack shouldn't contain any refs to the fat string anymore. Hrm... What happens if you

Re: Garbage collection

2020-06-27 Thread kinke via Digitalmars-d-learn
=> https://issues.dlang.org/show_bug.cgi?id=20983

Re: Garbage collection

2020-06-27 Thread kinke via Digitalmars-d-learn
On Saturday, 27 June 2020 at 10:08:15 UTC, James Gray wrote: have run into a memory leak Something seems really off indeed. I've run this on Win64 with DMD (2.092) and LDC (1.22), without any extra cmdline options: - import core.memory; import core.stdc.stdio; import std.range; import

Re: figure out where a particular template function is located

2020-06-24 Thread kinke via Digitalmars-d-learn
On Wednesday, 24 June 2020 at 21:05:12 UTC, Steven Schveighoffer wrote: I have a hard time believing that there's no way to do this! This would IMO be the job of the IDE. E.g., Visual D might be able to jump to the template declaration.

Re: figure out where a particular template function is located

2020-06-24 Thread kinke via Digitalmars-d-learn
On Wednesday, 24 June 2020 at 20:28:24 UTC, Steven Schveighoffer wrote: Is there a way to figure this out from the call? Another option would be running LDC with -vv for verbose codegen (be warned, lots and lots ouf output); we have fully qualified names in there.

Re: real.mant_dig on windows?

2020-06-23 Thread kinke via Digitalmars-d-learn
On Tuesday, 23 June 2020 at 02:56:36 UTC, 9il wrote: Should it always be 53? or it can be 64, when? Thank you For LDC, it's 53 (and .sizeof == 8) for MSVC targets, but 64 (x87) for MinGW, reflecting the accompanying C runtime's `long double`. [And IIRC, MS disallows any x87 usage in kernel

Re: called copy constructor in foreach with ref on Range

2020-06-22 Thread kinke via Digitalmars-d-learn
On Monday, 22 June 2020 at 20:51:37 UTC, Jonathan M Davis wrote: [...] That's why I put the struct in parantheses. Moving a class ref makes hardly any sense, but I've also never written a *class* to represent a range. Moving is the no-brainer solution for transferring ownership of struct

Re: how to skip the next (n) item & continue from (n+1) with a range ? e.g. in File(fn).byLine();

2020-06-22 Thread kinke via Digitalmars-d-learn
If you are referring to the next line, not the next n lines, that's a simple `continue;` statement.

Re: how to skip the next (n) item & continue from (n+1) with a range ? e.g. in File(fn).byLine();

2020-06-22 Thread kinke via Digitalmars-d-learn
On Monday, 22 June 2020 at 20:02:22 UTC, kinke wrote: If you are referring to the next line, not the next n lines, that's a simple `continue;` statement. [Please discard, that'd obviously be skipping the *current* line.]

Re: How to correctly integrate D library to Swift/Obj-C mobile project?

2020-06-22 Thread kinke via Digitalmars-d-learn
On Monday, 22 June 2020 at 19:41:22 UTC, Vlad wrote: Usually, when you connect c++/c, you have header files so you can call functions from Objective-C/swift code. We need something similar. There's a pretty recent -HC switch to generate C++ headers from `extern(C++)` declarations. Not sure

Re: called copy constructor in foreach with ref on Range

2020-06-22 Thread kinke via Digitalmars-d-learn
On Monday, 22 June 2020 at 19:03:44 UTC, Jonathan M Davis wrote: in practice, that means that generic code cannot use a range once it's been copied Translating to a simple rule-of-thumb: never copy a (struct) range, always move.

Re: called copy constructor in foreach with ref on Range

2020-06-22 Thread kinke via Digitalmars-d-learn
On Monday, 22 June 2020 at 16:25:11 UTC, Jonathan M Davis wrote: The reason that foreach copies the range is simply due to how the code is lowered. e.g. foreach(e; range) { } essentially becomes for(auto r = range; !r.empty; r.popFront()) { auto e = r.front; }

Re: called copy constructor in foreach with ref on Range

2020-06-21 Thread kinke via Digitalmars-d-learn
A foreach over a custom range makes an initial copy, so that the original range is still usable after the foreach (not empty).

Re: Arduino and MCU Support

2020-06-19 Thread kinke via Digitalmars-d-learn
On Friday, 19 June 2020 at 14:14:07 UTC, frasdoge wrote: though the -mcpu does not have any AVR options out-of-the-box as you mentioned. I guess you mean `ldc2 -mcpu=help` doesn't list any AVR CPUs. Use `ldc2 -mtriple=avr -mcpu=help`.

Re: Arduino and MCU Support

2020-06-19 Thread kinke via Digitalmars-d-learn
On Friday, 19 June 2020 at 14:14:07 UTC, frasdoge wrote: I'm having a bit of trouble understanding how to actually get started even with those links. I've installed the latest LDC and LLVM releases for Windows, though the -mcpu does not have any AVR options out-of-the-box as you mentioned.

Re: Arduino and MCU Support

2020-06-19 Thread kinke via Digitalmars-d-learn
On Friday, 19 June 2020 at 11:57:01 UTC, frasdoge wrote: I am looking to use D for microcontroller programming due to its benefits over C in workflow and general language features. I was wondering what the current state of this is, especially with regards to AVR. An example of the MCUs I

Re: Windows + LDC/DMD installation nightmare when changing VS versions

2020-06-12 Thread kinke via Digitalmars-d-learn
On Friday, 12 June 2020 at 15:21:12 UTC, Guillaume Piolat wrote: Any idea what could be causing this? Mentioning at least the used LDC version would be helpful; especially since the MSVC detection was completely overhauled with the v1.22 betas (and I think the previous

Re: how to achieve C's Token Pasting (##) Operator to generate variable name in D?

2020-05-30 Thread kinke via Digitalmars-d-learn
Using a mixin: string f(string x) { return "_" ~ x; } int main() { mixin("int "~f("x")~" = 3;"); return _x; }

Re: m32mscoff with lld-link causes SEH errors

2020-05-26 Thread kinke via Digitalmars-d-learn
On Monday, 25 May 2020 at 01:32:58 UTC, Daniel C wrote: Is lld-link only for 64-bit compiles (-m64 is the only one that gives no errors) Nope, but SafeSEH is a 32-bit-only feature. DMD doesn't emit SafeSEH compatible object files, and LLD seems to have a different default setting in that

Re: ModuleInfo and -fno-moduleinfo option

2020-05-26 Thread kinke via Digitalmars-d-learn
ModuleInfos are essential for the module ctors and dtors (of used modules) to be run, incl. a dependency tree defining their order of execution. They're also needed for running the unittests.

Re: large Windows mingw64 project in C99 --- need ABI compatible D compiler

2020-05-20 Thread kinke via Digitalmars-d-learn
On Wednesday, 20 May 2020 at 23:08:53 UTC, IGotD- wrote: When you mention the ABI, is there something particular you have in mind or just in general? The ABI for MinGW targets in general. - Judging by https://forum.dlang.org/post/anfwqjjsteeyelbdh...@forum.dlang.org, you apparently use a very

Re: large Windows mingw64 project in C99 --- need ABI compatible D compiler

2020-05-20 Thread kinke via Digitalmars-d-learn
On Wednesday, 20 May 2020 at 20:45:26 UTC, NonNull wrote: [...] so I will likely go with ldc2 with the option you suggested and see how it goes. Thanks again! You're welcome. If you do come across an ABI issue, make sure to file an LDC issue. While I have no interest in MinGW, I want at

Re: large Windows mingw64 project in C99 --- need ABI compatible D compiler

2020-05-20 Thread kinke via Digitalmars-d-learn
On Wednesday, 20 May 2020 at 18:53:01 UTC, NonNull wrote: Which D compiler should be used to be ABI compatible with mingw32? And which to be ABI compatible with mingw64? The natural choice for coupling mingw[64]-gcc would be GDC. Especially wrt. ABI, gdc apparently doesn't have to do much by

Re: After compiling Hello World with DMD Compiler, .EXE file takes 1-3 seconds to run for the first time

2020-05-18 Thread kinke via Digitalmars-d-learn
On Monday, 18 May 2020 at 15:49:06 UTC, Adam D. Ruppe wrote: It sees D programs as unusual and gives them additional scrutiny... Is that really the case for all D programs on Windows, or just those built with -m32 and thus using the exotic DigitalMars C runtime?

Re: Detecting performance pitfall in array access

2020-05-17 Thread kinke via Digitalmars-d-learn
On Sunday, 17 May 2020 at 11:39:30 UTC, kinke wrote: DMD v2.091: * dmd -m64 -O -release -boundscheck=off -run ..\speed.d aa bbc: ~11 μs I forgot `-inline` for DMD; that reduces the speed, yielding ~16 μs.

Re: Detecting performance pitfall in array access

2020-05-17 Thread kinke via Digitalmars-d-learn
On Sunday, 17 May 2020 at 03:30:57 UTC, Adnan wrote: In my machine, if you feed "aa" and "bbc" to the function, ldc generated code takes around 400 microseconds. I don't have an access to gdc in my machine. https://imgshare.io/image/NN8Xmp Full code: D : https://run.dlang.io/is/vLj7BC

Re: Linker error under Ubuntu

2020-05-15 Thread kinke via Digitalmars-d-learn
On Thursday, 14 May 2020 at 16:09:16 UTC, solidstate1991 wrote: When I try to compile my own project under Ubuntu with dub, I get the following linker error: /usr/bin/ld: .dub/obj/pixelperfectengine_pixelperfecteditor.o: undefined reference to symbol 'inflateEnd'

Re: Is is a Bug or just me?

2020-05-08 Thread kinke via Digitalmars-d-learn
On Friday, 8 May 2020 at 14:16:10 UTC, foerdi wrote: Now I am unsure if this is a bug or an undefined behavior that I don't know. This is a regression, and a potentially pretty bad one, so thx for tracking it down! If this is a bug, then I don't know how to call it for the bug tracker.

Re: XMM Intrinsics

2020-05-08 Thread kinke via Digitalmars-d-learn
On Friday, 8 May 2020 at 13:30:42 UTC, Marcio Martins wrote: I saw the intel-intrinsics package, but unfortunately it stops at SEE3 and I need SSE4.2 for this. How is this library working? It's open source. :) Will LDC/LLVM detect the name and replace it with the right instructions? If so,

Re: XMM Intrinsics

2020-05-08 Thread kinke via Digitalmars-d-learn
On Friday, 8 May 2020 at 12:49:00 UTC, Simen Kjærås wrote: How would I go about calling _mm_* functions in D in a way that is portable between D compilers? You would use core.simd: Nope one wouldn't, because that horrible interface isn't supported by LDC, and I guess GDC neither. The

  1   2   3   >