Re: Removing elements from dynamic array

2015-08-09 Thread kinke via Digitalmars-d-learn
On Sunday, 9 August 2015 at 14:24:38 UTC, Reflexive wrote: Error: module remove is in file 'std/algorithm/remove.d' which cannot be read remove() is a function in module std.algorithm: import std.algorithm: remove; remove(foo);

Re: Do users need to install VS runtime redistributable if linking with Microsoft linker?

2015-09-28 Thread kinke via Digitalmars-d-learn
Maybe LDC uses dynamic linking by default and DMD static one, same as on Linux? Yes, LDC does use dynamic linking by default (as MSVC iirc). Static linking can be enabled by providing the -DLINK_WITH_MSVCRT=OFF switch to the CMake command. OK, but why does that need to happen? I don't get

Re: ARSD PNG memory usage

2016-06-17 Thread kinke via Digitalmars-d-learn
On Friday, 17 June 2016 at 04:54:27 UTC, Joerg Joergonson wrote: LDC x64 uses about 250MB and 13% cpu. I couldn't check on x86 because of the error phobos2-ldc.lib(gzlib.c.obj) : fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'X86' not sure what that means

Re: How to group similar member functions from different classes?

2016-06-18 Thread kinke via Digitalmars-d-learn
On Saturday, 18 June 2016 at 07:03:25 UTC, cy wrote: So how would you do it? Defining A.foo, B.foo, etc in one place, and A.bar, B.bar, etc in another? No such thing in D. But you can always be creative and use an overloaded helper function containing the actual implementation if you want to

Re: pass a struct by value/ref and size of the struct

2016-03-23 Thread kinke via Digitalmars-d-learn
On Tuesday, 22 March 2016 at 07:35:49 UTC, ZombineDev wrote: If the object is larger than the size of a register on the target machine, it is implicitly passed by ref That's incorrect. As Johan pointed out, this is somewhat true for the Win64 ABI (but it firstly copies the argument before

Re: Typesafe variadic functions requiring at least one argument

2016-07-06 Thread kinke via Digitalmars-d-learn
In case you want a compile error if no arguments are specified, you can use something like this: void foo()() { static assert(0); } void foo(int[] ints...) { assert(ints); } void main() { foo(1, 2, 3); foo(); }

Re: Typesafe variadic functions requiring at least one argument

2016-07-06 Thread kinke via Digitalmars-d-learn
On Wednesday, 6 July 2016 at 19:50:11 UTC, pineapple wrote: I'd like to do something like this but it doesn't seem to be legal - void test(int[] ints...) if(ints.length){ // stuff } Not being able to specify this interferes with how I'd like to define my method overloads.

Re: struct: default construction or lazy initialization.

2017-02-01 Thread kinke via Digitalmars-d-learn
On Wednesday, 1 February 2017 at 23:02:11 UTC, bitwise wrote: On Wednesday, 1 February 2017 at 01:52:40 UTC, Adam D. Ruppe wrote: On Wednesday, 1 February 2017 at 00:43:39 UTC, bitwise wrote: Container!int c; // = Container!int() -> can't do this. Can you live with Container!int c =

Re: struct: default construction or lazy initialization.

2017-02-01 Thread kinke via Digitalmars-d-learn
On Wednesday, 1 February 2017 at 23:32:12 UTC, bitwise wrote: On Wednesday, 1 February 2017 at 23:24:27 UTC, kinke wrote: It's not that bad. D just doesn't support a default ctor for structs at all and simply initializes each instance with T.init. Your `s2` initialization is most likely seen

Re: How do I call a C++ struct default constructor from D?

2017-02-07 Thread kinke via Digitalmars-d-learn
On Tuesday, 7 February 2017 at 10:15:09 UTC, Atila Neves wrote: I can declare a C++ struct like so: extern(C++, mynamespace) struct Foo { //... } But... I don't want to repeat the initialisation code for that struct's default constructor. I can't declare one in D because D doesn't allow

Re: Cross-compile with LDC

2017-02-08 Thread kinke via Digitalmars-d-learn
On Wednesday, 8 February 2017 at 14:57:41 UTC, Oleg B wrote: Hello all! I want to build ldc cross compiller. I found this instruction https://wiki.dlang.org/LDC_cross-compilation_for_ARM_GNU/Linux, but I have some doubts: will it works with ldc-1.1.0? Particularly interested in the patch

Re: Cross-compile with LDC

2017-02-08 Thread kinke via Digitalmars-d-learn
On Wednesday, 8 February 2017 at 17:21:03 UTC, Oleg B wrote: If I understand correctly with vanilla LDC I can't cross-compiling from host linux-x86_64, but with your patch I can. Right? Right. Joakim Noah has worked on LDC for Android and as far as I know provides some prebuilt compilers, a

Re: "template with auto ref" experiment

2017-02-04 Thread kinke via Digitalmars-d-learn
On Saturday, 4 February 2017 at 14:33:12 UTC, Alex wrote: Having read this https://dlang.org/spec/template.html#auto-ref-parameters I tried to do something like this // Code starts here void main() { initStruct iSb; iSb.var = 3; A b = A(iSb); assert(*b.myVar ==

Re: General performance tips

2017-01-23 Thread kinke via Digitalmars-d-learn
On Monday, 23 January 2017 at 12:13:30 UTC, albert-j wrote: There's not much object creation going on there, mostly loops over arrays, so I assume GC is not an issue. When passing arrays around, beware that static arrays are value types in D and are copied unless passed by reference.

Re: embedding a library in Windows

2017-01-30 Thread kinke via Digitalmars-d-learn
You'll probably be more successful with a static .lib library generated with the MS compiler (Visual Studio). I'd suggest compiling sqlite yourself and then using DMD with the `-m32mscoff` switch (32-bit) or `-m64` for 64-bit. Google is your friend in case you don't know how to build a static

Re: Create doc simultaneously with compilation

2017-02-20 Thread kinke via Digitalmars-d-learn
On Sunday, 19 February 2017 at 22:44:54 UTC, Satoshi wrote: Why is not possible to create documentation, compile code and generate header files simultaneously? When I pass -D and -Dd flags to ldc2 command it won't create doc until I don't pass -o- flag too. That is an LDC bug which has been

Re: align(n) outside struct useless?

2017-02-20 Thread kinke via Digitalmars-d-learn
On Monday, 20 February 2017 at 22:45:09 UTC, Adam D. Ruppe wrote: I don't believe it does anything (except perhaps pad bytes again) for a stack-defined struct. LDC does respect explicit type-alignments when allocating instances on the stack. The instances are obviously padded to their full

Re: Checking, whether string contains only ascii.

2017-02-22 Thread kinke via Digitalmars-d-learn
On Wednesday, 22 February 2017 at 20:07:34 UTC, Ali Çehreli wrote: One more: bool isAscii(string s) { import std.string : representation; import std.algorithm : canFind; return !s.representation.canFind!(c => c >= 0x80); } unittest { assert(isAscii("hello world"));

Re: RAII

2017-02-23 Thread kinke via Digitalmars-d-learn
On Thursday, 23 February 2017 at 09:57:09 UTC, ketmar wrote: Arun Chandrasekaran wrote: Is there an elegant way to achieve this in D? why not static method or free function that returns struct? due to NRVO[0] it won't even be copied. That's not elegant. You need a factory function for each

Re: RAII

2017-02-23 Thread kinke via Digitalmars-d-learn
On Thursday, 23 February 2017 at 14:24:14 UTC, Adam D. Ruppe wrote: On Thursday, 23 February 2017 at 10:48:38 UTC, kinke wrote: That's not elegant. You need a factory function for each type containing one of these structs then. A constructor is just a factory function with a special name...

Re: RAII

2017-02-23 Thread kinke via Digitalmars-d-learn
On Thursday, 23 February 2017 at 18:46:58 UTC, kinke wrote: A constructor is just a factory function with a special name... Wrt. the special name, that's obviously extremely useful for generic templates (containers etc.).

Re: Can't send messages to tid spawned in a Windows DLL. Bug?

2017-02-16 Thread kinke via Digitalmars-d-learn
On Thursday, 16 February 2017 at 12:07:40 UTC, Atila Neves wrote: This fails for me in a DLL: auto tid = spawn(); assert(tid != Tid.init); If I print out the tid, I find that its message box is null. This is odd, since according the code in std.concurrency there's nothing weird about how it

Re: Printing a floats in maximum precision

2017-01-18 Thread kinke via Digitalmars-d-learn
On Wednesday, 18 January 2017 at 03:36:39 UTC, Nicholas Wilson wrote: Alternatively use %a to print in hex to verify exact bit patterns. +1, if it doesn't have to be human-readable.

Re: Initializing floating point types with explicit mantisa and exponent

2017-01-17 Thread kinke via Digitalmars-d-learn
On Tuesday, 17 January 2017 at 00:08:24 UTC, Nordlöw wrote: How do I best initialize a D double to an exact mantissa and exponent representation? I'm specifically interested in 2^^i for all i in [min_exp, max_exp] If it doesn't have to be D ;), it can be as simple as

Re: Thread will get garbage collected?

2017-01-16 Thread kinke via Digitalmars-d-learn
On Monday, 16 January 2017 at 22:08:56 UTC, JN wrote: Am I correctly understanding, that after going out of scope, it's possible for GC to destroy my thread before the file finishes loading? How to prevent GC from destroying my thread before it finishes and make sure the file is loaded

Re: Querying parameter passing semantics for `auto ref const` variables

2017-01-15 Thread kinke via Digitalmars-d-learn
On Sunday, 15 January 2017 at 14:33:25 UTC, Nordlöw wrote: A call to `isRef!T` inside the function `f` is always `false` for `l-value` and `r-value` passing. According to https://dlang.org/spec/template.html#auto-ref-parameters, it should be `__traits(isRef, x)`.

Re: this is not an lvalue

2016-12-15 Thread kinke via Digitalmars-d-learn
On Thursday, 15 December 2016 at 15:29:13 UTC, Adam D. Ruppe wrote: General rule of thumb: if you are refing for performance, actually check it before and after first, ref isn't always faster. But D doesn't make this easy, as it disallows rvalues to be passed by ref. It's a very common

Re: this is not an lvalue

2016-12-13 Thread kinke via Digitalmars-d-learn
On Tuesday, 13 December 2016 at 17:52:21 UTC, Adam D. Ruppe wrote: On Tuesday, 13 December 2016 at 17:26:28 UTC, kink wrote: Assuming `Parameter` is a class and not a struct, yes. Even if it is a struct, ref wouldn't make a difference here because the variable is assigned to a member, which

Re: Hopefully a simple question...

2017-01-13 Thread kinke via Digitalmars-d-learn
On Friday, 13 January 2017 at 16:56:43 UTC, WhatMeWorry wrote: A vec and scalar can't be added together. So why (or how) is the glm code working? The C++ source disagrees: https://github.com/g-truc/glm/blob/master/glm/detail/type_vec2.hpp#L219 It works via operator overloading, and adding a

Re: meaning of "auto ref const"?

2016-12-18 Thread kinke via Digitalmars-d-learn
On Sunday, 18 December 2016 at 13:14:08 UTC, Picaud Vincent wrote: bool opEquals()(auto ref const BigInt y) const pure @nogc { return sign == y.sign && y.data == data; } my problem is that I do not understand the role/meaning of "auto" in this context. See

Re: Returning structs from COM

2016-12-19 Thread kinke via Digitalmars-d-learn
On Saturday, 3 December 2016 at 09:51:00 UTC, John C wrote: Some DirectX methods return structs by value, but when I try calling them I either get garbage or an access violation. Usually COM methods return structs by pointer as a parameter, but these are returning the struct as the actual

Re: returning struct, destructor

2016-12-21 Thread kinke via Digitalmars-d-learn
On Wednesday, 21 December 2016 at 18:02:54 UTC, bauss wrote: It removes an unnecessary allocation for the returning copy of the struct, as the return value is never used. Hence why it's pointless that it would be compiled anyway. That's incorrect, it doesn't have anything to do with the

Re: returning struct, destructor

2016-12-21 Thread kinke via Digitalmars-d-learn
On Wednesday, 21 December 2016 at 15:01:20 UTC, Eugene Wissner wrote: On Wednesday, 21 December 2016 at 14:15:06 UTC, John C wrote: On Wednesday, 21 December 2016 at 11:45:18 UTC, Eugene Wissner wrote: This prints 3 times "Destruct" with dmd 0.072.1. If I remove the if block, it prints

Re: BetterC classes

2016-12-20 Thread kinke via Digitalmars-d-learn
On Tuesday, 20 December 2016 at 13:30:54 UTC, Kagamin wrote: On Friday, 16 December 2016 at 18:29:33 UTC, Ilya Yaroshenko wrote: Undefined symbols for architecture x86_64: "__D14TypeInfo_Class6__vtblZ", referenced from: __D8cppclass2Hw7__ClassZ in cppclass-7ed89bd.o By using typeid

Re: Returning structs from COM

2016-12-19 Thread kinke via Digitalmars-d-learn
On Monday, 19 December 2016 at 09:49:13 UTC, kinke wrote: That's rather interesting. The COM function really seems to return the struct directly, not returning an HRESULT and setting some output pointee as most COM functions I've seen so far. According to the Win64 ABI, the returned

Re: Returning structs from COM

2016-12-19 Thread kinke via Digitalmars-d-learn
https://issues.dlang.org/show_bug.cgi?id=16987 https://github.com/ldc-developers/ldc/issues/1935

Re: Returning structs from COM

2016-12-19 Thread kinke via Digitalmars-d-learn
On Monday, 19 December 2016 at 12:23:46 UTC, evilrat wrote: x64 still has messed up 'this'(both dmd and ldc, not tested with gdc) Please file an LDC issue then, as I'm pretty sure it works for regular (non-COM) C++ classes.

Re: C++ namespace mangling: bug or me being stupid?

2017-03-28 Thread kinke via Digitalmars-d-learn
That's a mangling compression scheme (possibly tunable via gcc options), from https://github.com/gchatelet/gcc_cpp_mangling_documentation: To save space a compression scheme is used where symbols that appears multiple times are then substituted by an item from the sequence : S_, S0_, S1_, S2_,

Re: union.sizeof

2017-03-25 Thread kinke via Digitalmars-d-learn
On Saturday, 25 March 2017 at 22:45:22 UTC, ketmar wrote: zabruk70 wrote: //DMD 2.073.1 and latest 2.075.0-master-972eaed //Windows 7 32-bit union Union1 { align(1): byte[5] bytes5; struct { align(1): char char1; uint int1; } } void main () { import

Re: union.sizeof

2017-03-25 Thread kinke via Digitalmars-d-learn
On Saturday, 25 March 2017 at 22:54:30 UTC, zabruk70 wrote: But for clearness... I was thinked, that align not changes SIZE, but changes LOCATION. I was thinked, that "align(X) union Union1" just force compiler to place Union1 on boundaries of X bytes... In order for all Union1 instances in

Re: Error: out of memory

2017-03-18 Thread kinke via Digitalmars-d-learn
The Win64 LDC releases [https://github.com/ldc-developers/ldc/releases] feature a 64-bit compiler.

Re: questions about dub

2017-03-21 Thread kinke via Digitalmars-d-learn
On Tuesday, 21 March 2017 at 21:01:31 UTC, thorstein wrote: C:\..\AppData\Roaming\dub>dub run mir-algorithm Building package mir-algorithm in C:\..\AppData\Roaming\dub\packages\mir-algorithm-0.1.1\mir-algorithm\ Fetching mir-internal 0.0.5 (getting selected version)... Main package must have a

Re: Windows X64 Calling conventions

2017-04-20 Thread kinke via Digitalmars-d-learn
On Thursday, 20 April 2017 at 01:16:11 UTC, Tofu Ninja wrote: My question is, why is it passed twice, both in xmm0 and rcx? The MSDN docs say floating point are passed in xmm registers, why is it also copied in into rcx? Is it necessary for anything? That is only required for variadics,

Re: multi-dimensional array whole slicing

2017-04-22 Thread kinke via Digitalmars-d-learn
On Saturday, 22 April 2017 at 20:51:46 UTC, XavierAP wrote: I can do: int[3] arr = void; arr[] = 1; But apparently I can't do: int[3][4] arr = void; arr[][] = 1; What is the best way? What am I missing? int[3][4] arr = void; (cast(int[]) arr)[] = 1; assert(arr[3][2] == 1);

Re: Cconditional expression in return statement. Bug?

2017-03-07 Thread kinke via Digitalmars-d-learn
On Tuesday, 7 March 2017 at 14:26:18 UTC, Jack Applegame wrote: I'm pretty sure this is a bug. And very bad bug. I spent several hours looking for it. What do you think? Definitely a very bad bug. It works too if you mark `fun()` as nothrow. Please file a DMD issue.

Re: Force usage of double (instead of higher precision)

2017-06-28 Thread kinke via Digitalmars-d-learn
On Wednesday, 28 June 2017 at 22:16:48 UTC, Simon Bürger wrote: I am currently using LDC on 64-bit-Linux if that is relevant. It is, as LDC on Windows/MSVC would use 64-bit compile-time reals. ;) Changing it to double on other platforms is trivial if you compile LDC yourself. You'll want

Re: Force usage of double (instead of higher precision)

2017-06-30 Thread kinke via Digitalmars-d-learn
On Friday, 30 June 2017 at 11:42:39 UTC, Luis wrote: On Thursday, 29 June 2017 at 12:00:53 UTC, Simon Bürger wrote: Thanks a lot for your comments. On Wednesday, 28 June 2017 at 23:56:42 UTC, Stefan Koch wrote: [...] This is only happening on CTFE ? Enforcing to use the old 8086 FPU for

Re: Force usage of double (instead of higher precision)

2017-06-30 Thread kinke via Digitalmars-d-learn
On Friday, 30 June 2017 at 16:21:18 UTC, kinke wrote: CTFE only (incl. parsing of literals). Just make sure you don't happen to call a std.math function only accepting reals; I don't know how many of those are still around. Oh, apparently most still are. There are even some mean overloads

Re: Force usage of double (instead of higher precision)

2017-06-30 Thread kinke via Digitalmars-d-learn
On Friday, 30 June 2017 at 16:39:16 UTC, Stefan Koch wrote: On Friday, 30 June 2017 at 16:29:22 UTC, kinke wrote: On Friday, 30 June 2017 at 16:21:18 UTC, kinke wrote: CTFE only (incl. parsing of literals). Just make sure you don't happen to call a std.math function only accepting reals; I

Re: C++ Interfacing:'static' array function parameter contradiction

2017-04-28 Thread kinke via Digitalmars-d-learn
On Friday, 28 April 2017 at 18:07:49 UTC, ParticlePeter wrote: Interesting, your example corresponds to my third case, the linker error. I am on Window, building an x64 App, afaik in that case the MS Visual Studio linker is used instead of optilink. Will add your findings to the bug report.

Re: problem with std.variant rounding

2017-04-28 Thread kinke via Digitalmars-d-learn
On Friday, 28 April 2017 at 16:24:55 UTC, Suliman wrote: import std.stdio; import std.variant; void main() { Variant b = 56.051151; float x = b.coerce!float; writeln(x); } 56.0512 void main() { import core.stdc.stdio; import std.stdio; double d =

Re: C++ Interfacing:'static' array function parameter contradiction

2017-04-28 Thread kinke via Digitalmars-d-learn
On Friday, 28 April 2017 at 15:56:17 UTC, ParticlePeter wrote: So what next? How can I interface to the cpp function? *** C++: bool cppFunc(float ()[3]) { color[0] = 1; color[1] = 2; color[2] = 3; return true; } *** D: extern(C++) bool cppFunc(ref float[3] color); void

Re: D on Power8 (PPC64)

2017-08-07 Thread kinke via Digitalmars-d-learn
On Monday, 7 August 2017 at 20:39:40 UTC, Dmitry Olshansky wrote: What is the status of the platform? I might be doing some number crunching on one of the power8 beasts, would be nice to have D working there. Not that bad afaik. LDC should be able to build itself, the runtime libs and their

Re: struct field initialization

2017-08-16 Thread kinke via Digitalmars-d-learn
On Wednesday, 16 August 2017 at 18:11:05 UTC, bitwise wrote: If I define a non-default constructor for a struct, are the fields initialized to T.init by the time it's called? The struct instance is initialized with T.init before invoking the constructor.

Productive vibe.d dev environment (IDE, debugger) on Linux?

2017-05-03 Thread kinke via Digitalmars-d-learn
Hey guys, can anyone recommend a more or less production-ready dev environment for vibe.d on Linux? I'm evaluating vibe.d against Phoenix (Elixir/Erlang) for a new project. Today I gave Visual Studio Code a quick shot (with LDC 1.1.1 and DMD 2.071/72/74), with Webfreak's plugins, but I'm not

Re: D on AArch64 CPU

2017-05-14 Thread kinke via Digitalmars-d-learn
On Sunday, 14 May 2017 at 15:11:09 UTC, Richard Delorme wrote: On Sunday, 14 May 2017 at 15:05:08 UTC, Richard Delorme wrote: I did not touch at std.conv nor std.stdio. On LDC, the only modification concerned math.d and gammafuntion.d, missing support for 128-bit floating points. On GDC, I had

Re: interfacing Cpp - GCC Dual ABI abi_tag in name mangling

2017-04-29 Thread kinke via Digitalmars-d-learn
On Saturday, 29 April 2017 at 18:08:16 UTC, سليمان السهمي (Soulaïman Sahmi) wrote: GCC has this attribute called abi_tag that they put on any function that returns std::string or std::list The usual workaround is compiling the C++ source with _GLIBCXX_USE_CXX11_ABI=0 for gcc >= 5.

Re: C++ Interfacing:'static' array function parameter contradiction

2017-04-29 Thread kinke via Digitalmars-d-learn
On Saturday, 29 April 2017 at 18:54:36 UTC, سليمان السهمي (Soulaïman Sahmi) wrote: But still, this needs to be fixed, copy pasting the name mangling is in my opinion just a hack for your specific cpp compiler on your specific platform. It can't be fixed on the D side as the Visual C++

Re: initializing a static array

2017-10-10 Thread kinke via Digitalmars-d-learn
On Tuesday, 10 October 2017 at 14:15:07 UTC, Simon Bürger wrote: On Tuesday, 10 October 2017 at 13:48:16 UTC, Andrea Fontana wrote: Maybe: double[n] bar = 0.repeat(n).array; This works fine, thanks a lot. I would have expected `.array` to return a dynamic array. But apparently the compiler

Re: initializing a static array

2017-10-10 Thread kinke via Digitalmars-d-learn
On Tuesday, 10 October 2017 at 22:00:27 UTC, kinke wrote: [...] Ah sorry, overlooked that it's the initializer for a struct field.

Re: erros em printf[AJUDA]

2017-09-08 Thread kinke via Digitalmars-d-learn
On Friday, 8 September 2017 at 22:30:16 UTC, dark777 wrote: ex3.d(19): Error: cannot pass dynamic arrays to extern(C) vararg functions printf("Writef Hello %.*s!\n", name.length, name.ptr);

Re: static this not run?

2017-09-30 Thread kinke via Digitalmars-d-learn
On Saturday, 30 September 2017 at 12:07:21 UTC, Nicholas Wilson wrote: Hmm. Everything except for the main function was in a different module, I dont see why that would cause it to not be run, but then bugs have a tendency to do strange things like that. I'll have to dust mite DCompute and see

Re: Sectioned variables?

2017-09-28 Thread kinke via Digitalmars-d-learn
On Wednesday, 27 September 2017 at 11:59:16 UTC, Arav Ka wrote: GCC supports a `__attribute((section("...")))` for variables to put them in specific sections in the final assembly. Is there any way this can be achieved in D? Does GDC support this? LDC does, see

Re: Is it possible to specify the address returned by the address of operator?

2017-09-28 Thread kinke via Digitalmars-d-learn
On Thursday, 28 September 2017 at 10:24:28 UTC, Jonathan M Davis wrote: On Wednesday, September 27, 2017 22:01:26 DreadKyller via Digitalmars-d- learn wrote: Also off-topic slightly, but am I the only one with massive latency on this site? It took like almost 2 minutes from me hitting reply

Re: 24-bit int

2017-09-02 Thread kinke via Digitalmars-d-learn
On Saturday, 2 September 2017 at 02:37:08 UTC, Mike Parker wrote: It's not a bug, but a feature. Data structure alignment is important for efficient reads, so several languages (D, C, C++, Ada, and more) will automatically pad structs so that they can maintain specific byte alignments. On a

Re: Need importing dcompute.lib into my project

2017-10-07 Thread kinke via Digitalmars-d-learn
On Saturday, 7 October 2017 at 09:04:26 UTC, kerdemdemir wrote: Error: static assert "Need to use a DCompute enabled compiler" Are you using latest LDC 1.4? The CUDA backend wasn't enabled for earlier versions.

Re: DMD Test Suite Windows

2017-12-18 Thread kinke via Digitalmars-d-learn
On Monday, 18 December 2017 at 16:06:33 UTC, Jonathan Marler wrote: Trying to run the dmd test suite on windows, looks like Digital Mars "make" doesn't work with the Makefile, I tried Gnu Make 3.81 but no luck with that either. Anyone know which version of make it is supposed to work with on

Re: LDC phobos2-ldc.lib(json.obj) : fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'x86'

2018-05-04 Thread kinke via Digitalmars-d-learn
On Thursday, 3 May 2018 at 23:47:40 UTC, IntegratedDimensions wrote: Maybe this is a cross compilation issue? Looks like you simply didn't download the LDC multilib package.

Re: C API / const char *text / std.string.toStringz pointer is always NULL on C side

2018-05-19 Thread kinke via Digitalmars-d-learn
On Saturday, 19 May 2018 at 17:33:08 UTC, Robert M. Münch wrote: On 2018-05-18 14:42:17 +, Adam D. Ruppe said: A value struct return is actually done via a hidden pointer parameter (so the function can construct it in-place for the caller, a standard optimization), so it just shifted all

Re: C++ / Wrong function signature generated for reference parameter

2018-05-03 Thread kinke via Digitalmars-d-learn
On Thursday, 3 May 2018 at 07:00:03 UTC, Robert M. Münch wrote: using struct won't give the correct signature That's why there's `extern(C++, class) struct Image`, see https://dlang.org/spec/cpp_interface.html#classes. Not sure about the const part too, if this is correct on the D side...

Re: Range over a container r-value with disabled postblit

2018-01-14 Thread kinke via Digitalmars-d-learn
On Sunday, 14 January 2018 at 01:38:17 UTC, Nordlöw wrote: My current proposal for a solution is to make `byElement` a free unary function byElement(auto ref X x) which statically checks via static if (__traits(isRef, x)) whether the `X`-instance is passed as either an - l-value,

Re: __gshared as part of alias

2018-01-17 Thread kinke via Digitalmars-d-learn
On Wednesday, 17 January 2018 at 22:01:57 UTC, Johan Engelen wrote: ``` struct GSharedVariable(AddrSpace as, T) { static __gshared T val; alias val this; } alias Global(T) = GSharedVariable!(AddrSpace.Global, T); Global!float bar1; // __gshared ``` Only 1 value per T though. ;)

Re: Class instance memory overhead lower than 3 words?

2018-01-25 Thread kinke via Digitalmars-d-learn
On Wednesday, 24 January 2018 at 21:48:21 UTC, Nordlöw wrote: Why is the memory overhead for a class instance as high as 3 words (24 bytes on 64-bit systems? I find that annoyingly much for my knowledge database application. I'm aware of extern(C++), having one word overhead, but such

Re: inline @trusted code

2018-01-30 Thread kinke via Digitalmars-d-learn
On Tuesday, 30 January 2018 at 15:05:38 UTC, ikod wrote: Hello, Several times I faced with next problem: I have "@safe" routine with few calls to @system functions inside: OS calls (recv, send, kqueue) os some phobos unsafe functions like assumeUnique. I'd like not to wrap these @system

Re: Where is TypeInfo_Class.m_init set

2018-07-31 Thread kinke via Digitalmars-d-learn
On Tuesday, 31 July 2018 at 01:16:29 UTC, Hakan Aras wrote: I was hoping it would be possible without tinkering with the compiler, but it doesn't seem to be the case. I've been playing around with LDC. There is an init symbol for classes, which is normally used as payload for the ClassInfo's

Re: Where is TypeInfo_Class.m_init set

2018-07-31 Thread kinke via Digitalmars-d-learn
Sorry, scratch that, I forgot the `extern` before the dummy global. After fixing that, I didn't quickly find a solution for referencing the symbol in the .data.rel.ro section (LLVM asm, e.g., `void* getInit() { return __asm!(void*)("movq test.C.__init, %rax", "={rax}"); }` doesn't work

Re: Compiler build error

2018-08-04 Thread kinke via Digitalmars-d-learn
On Saturday, 4 August 2018 at 18:12:05 UTC, Alex wrote: /snap/ldc2/78/bin/ldc2(_start+0x29)[0x8b7ee9] You haven't specified the DMD version you are using. Your LDC is 'outdated', so make sure to first check whether it still fails with an up-to-date version before potentially wasting time.

Re: Compiler build error

2018-08-04 Thread kinke via Digitalmars-d-learn
On Saturday, 4 August 2018 at 13:29:36 UTC, kinke wrote: [...] as it features debuginfos Sorry, scrach that (it used to for the Windows CI build but doesn't anymore).

Re: Compiler build error

2018-08-04 Thread kinke via Digitalmars-d-learn
You're most likely hitting an ICE in the front-end (as both compilers crash). What you can always do is invoke the compiler in a GDB session. That's especially useful with an LDC CI build (download: https://github.com/ldc-developers/ldc/releases/tag/CI), as it features debuginfos and enabled

Re: pointer cast from const(Y) to immutable(void*)** is not supported at compile time

2018-08-02 Thread kinke via Digitalmars-d-learn
On Thursday, 2 August 2018 at 02:13:41 UTC, Hakan Aras wrote: I do want it at compiletime though. Totally understandable; that's a regression and needs to be fixed. See https://github.com/dlang/dmd/pull/8362#pullrequestreview-142565787.

Re: Where is TypeInfo_Class.m_init set

2018-08-02 Thread kinke via Digitalmars-d-learn
On Thursday, 2 August 2018 at 02:52:44 UTC, Hakan Aras wrote: LDC complains about the type of initializer though: onlineapp.d(22): Error: Global variable type does not match previous declaration with same mangled name: _D5bclib3Baz6__initZ onlineapp.d(22):Previous IR type: %bclib.Baz

Re: Dlang on OpenWrt

2018-08-02 Thread kinke via Digitalmars-d-learn
You could give LDC's armhf build a try. It's built on Debian Jessie and requires ARMv6 or newer, so it might work. Download: https://github.com/ldc-developers/ldc/releases

Re: Trouble with LDC2 and definition file to hide console?

2018-08-20 Thread kinke via Digitalmars-d-learn
On Monday, 20 August 2018 at 13:49:19 UTC, rikki cattermole wrote: That is for Optlink not for MSVC link which ldc uses. Exactly. For LDC, just rename your main() to WinMain().

Re: Trouble with LDC2 and definition file to hide console?

2018-08-20 Thread kinke via Digitalmars-d-learn
For LDC, just rename your main() to WinMain(). Or alternatively, `-L/SUBSYSTEM:WINDOWS -L/ENTRY:mainCRTStartup` in the LDC cmdline.

Re: Cross compile windows programs on linux

2018-08-24 Thread kinke via Digitalmars-d-learn
On Friday, 24 August 2018 at 13:10:40 UTC, John Burton wrote: Is in the subject. Are there any cross compilers that will run on a linux system but compile D code using Win32 into a windows .exe file, preferably 64 bit? I can find hints of cross compilers but not really seen anything packaged

Re: Static initialization of static arrays is weird

2018-08-19 Thread kinke via Digitalmars-d-learn
On Sunday, 19 August 2018 at 11:20:41 UTC, Dennis wrote: I have a two dimensional static array in a game board struct and want to explicitly set the default value for each cell. Now typing the whole 9x9 array out would be cumbersome and I can't change the default constructor of a struct, so I

Re: Is there any plan for a dependency-free subset of "core" runtime?

2018-07-19 Thread kinke via Digitalmars-d-learn
On Thursday, 19 July 2018 at 12:44:30 UTC, Radu wrote: --- int foo() { import std.algorithm, std.range; auto r = 100.iota.stride(2).take(5); return r.sum(); } --- ldc2 -mtriple=wasm32-unknown-unknown-wasm -betterC -link-internally -L-allow-undefined -release -Os wasm.d

Re: Cannot make sense of LLD linker error with ldc 1.11.0

2018-08-30 Thread kinke via Digitalmars-d-learn
On Thursday, 30 August 2018 at 13:36:58 UTC, Per Nordlöw wrote: [...] LDC uses the C compiler as linker driver by default, exactly because the linker needs some setup (default lib dirs etc.). So this is almost certainly a dub issue.

Re: Cannot make sense of LLD linker error with ldc 1.11.0

2018-08-30 Thread kinke via Digitalmars-d-learn
Nope, I now think this is more likely an issue with the default config (etc/ldc2.conf). It contains a new section for WebAssembly, which specificies `-link-internally`, which seems to be wrongly used for non-WebAssembly too in your case. I take it you're not using an official package, but a

Re: Cannot make sense of LLD linker error with ldc 1.11.0

2018-08-30 Thread kinke via Digitalmars-d-learn
On Thursday, 30 August 2018 at 19:41:38 UTC, Nordlöw wrote: I'm using the tar.xz for x64 Linux. Ok? You're explicitly adding `-link-internally` in your top-level dub.sdl: dflags "-link-internally" platform="linux-ldc" # use GNU gold linker If you want to go with gold, as your comment

Re: ldc2 crashes when trying to compile my app

2018-09-01 Thread kinke via Digitalmars-d-learn
On Saturday, 1 September 2018 at 19:35:53 UTC, Per Nordlöw wrote: What should I grep for when trying to Dustmite this? `_Z7DtoLValP6DValue` may be suitable. - I don't use dustmite and prefer manual minimization; e.g., by adding `-vv > bla.log` to the crashing commandline. The last lines in

Re: Cannot make sense of LLD linker error with ldc 1.11.0

2018-09-01 Thread kinke via Digitalmars-d-learn
On Saturday, 1 September 2018 at 18:46:32 UTC, Nordlöw wrote: Thanks! Is there usually only apps and not libs that are supposed to have linker flags like these? In this specific case, I'm not sure it's a good idea to set the linker in the dub config. Does it absolutely require gold, i.e.,

Re: Issues with undefined symbols when using Vibe on Windows

2018-07-04 Thread kinke via Digitalmars-d-learn
On Wednesday, 4 July 2018 at 20:36:55 UTC, Chris M. wrote: On Tuesday, 3 July 2018 at 18:35:43 UTC, kinke wrote: On Tuesday, 3 July 2018 at 17:54:08 UTC, Seb wrote: [...] AFAICT, the issue is that MinGW is used, as opposed to MinGW-w64 (a confusingly separate project unfortunately AFAIK).

Re: Issues with undefined symbols when using Vibe on Windows

2018-07-03 Thread kinke via Digitalmars-d-learn
On Tuesday, 3 July 2018 at 17:54:08 UTC, Seb wrote: BTW in case someone has a bit of time to look at the MinGW headers. They are built as part of the `build-mingw-libs` branch at the installer repo: https://github.com/dlang/installer/blob/build-mingw-libs/windows/build_mingw.bat This is

Re: dub / win 64 / unresolved externals from run-time lib?

2018-03-08 Thread kinke via Digitalmars-d-learn
On Thursday, 8 March 2018 at 17:03:18 UTC, Robert M. Münch wrote: Using Dub and pretty simple setup, that links in 3 C/C++ static libraries, I get these linker errors: libyogacore.lib(Yoga.obj) : error LNK2019: unresolved external symbol __imp_fmodf referenced in function "void __cdecl

Re: Benchmarking sigmoid function between C and D

2018-04-08 Thread kinke via Digitalmars-d-learn
On Sunday, 8 April 2018 at 05:35:10 UTC, Arun Chandrasekaran wrote: Did you also generate the bar graph plot using D? Heh nope, I used LibreOffice Calc for that.

Re: Destructor call

2018-04-10 Thread kinke via Digitalmars-d-learn
On Tuesday, 10 April 2018 at 18:34:54 UTC, n0fun wrote: Why the destructor is called in the second case and why not in the first? The first case is RAII, where destruction isn't done for not fully constructed instances. The second case is GC finalization at program shutdown and looks like a

Re: Benchmarking sigmoid function between C and D

2018-04-09 Thread kinke via Digitalmars-d-learn
On Saturday, 7 April 2018 at 21:53:23 UTC, Guillaume Piolat wrote: Have you tried LLVM intrinsics? say llvm_exp While LLVM does have math intrinsics, they seem to boil down to C runtime calls in many/most cases. I.e., on Linux x86_64, `llvm_exp(real)` simply maps to the C function `expl()`

Re: Benchmarking sigmoid function between C and D

2018-04-07 Thread kinke via Digitalmars-d-learn
On Saturday, 7 April 2018 at 20:33:13 UTC, Arun Chandrasekaran wrote: Much better with mir.math.common, still a bit slower than C (even with larger loops): As this appears to be benchmarking mostly the std.math.exp(float) performance - some/many basic algos in std.math, incl. exp(), are

Re: Ldc on Windows

2018-04-17 Thread kinke via Digitalmars-d-learn
On Tuesday, 17 April 2018 at 11:01:21 UTC, Nicholas Wilson wrote: You should also be able to use -link-internally /LLMV's lld if you don't want to install MSVC Nope, the MSVC libs are still required, and no, the ancient ones shipping with DMD can't be used.

  1   2   3   4   >