Re: D & C++ class question

2018-11-28 Thread Nicholas Wilson via Digitalmars-d-learn
On Wednesday, 28 November 2018 at 07:22:46 UTC, bauss wrote: If I have a class from D. How would you use that class in C++? Like what's the correct approach to this. Would it work just by doing "extern(C++)" or will that only work for D to use C++ classes? If you have foo.d class Foo

How to center dlangui on screen

2018-11-28 Thread greatsam4sure via Digitalmars-d-learn
I am learning Dlang and Dlangui. I encounter, a little problem on: how to center dlangui window on screen. How to set the window width and height outside the constructor How to maximize and minimize the window using code. How to set global font for the application. The font display is not

Re: How to debug FinalizeError?

2018-11-28 Thread unDEFER via Digitalmars-d-learn
No I'm not preallocating any exceptions. It was idea, but I removed all calls which can make throw. I'm using very old dmd 2.074.1, so as I have patched it for my text editor with IDE functions. I had a year break in development, so now I need to rewrite all my patches. But exactly the output

Why pow() won't go beyond 2^31?

2018-11-28 Thread Murilo via Digitalmars-d-learn
I am using the function pow() from std.math but if I try pow(2, 32) it returns 0, it doesn't compute beyond the maximum value of an int(2^31) and I am working with long. What should I do?

Re: How to center dlangui Window on screen

2018-11-28 Thread bauss via Digitalmars-d-learn
On Wednesday, 28 November 2018 at 23:07:50 UTC, greatsam4sure wrote: On Wednesday, 28 November 2018 at 17:23:21 UTC, Edgar Huckert wrote: On Wednesday, 28 November 2018 at 08:55:11 UTC, greatsam4sure wrote: I am learning Dlang and Dlangui. I encounter, a little problem on: how to center

Re: How to iterate getSymbolsByUDA

2018-11-28 Thread Steven Schveighoffer via Digitalmars-d-learn
On 11/28/18 2:18 AM, Eko Wahyudin wrote: static foreach(sym; getSymbolsByUDA!(A, Attr)){    writeln(sym.stringof); // print variable name "a" this what i want } foreach(sym; getSymbolsByUDA!(A, Attr)){    writeln(sym.stringof);  // print "sym" } foreach(sym; getSymbolsByUDA!(A,

Re: D & C++ class question

2018-11-28 Thread Nicholas Wilson via Digitalmars-d-learn
On Wednesday, 28 November 2018 at 13:13:40 UTC, bauss wrote: Well unfortunately I cannot control the C++ side of things, but I assume that it'll work properly with extern(C++) so I guess I will just go ahead and try and see if everything works out. I have access to the C++ source so at the

Re: D & C++ class question

2018-11-28 Thread bauss via Digitalmars-d-learn
On Wednesday, 28 November 2018 at 13:42:43 UTC, Nicholas Wilson wrote: On Wednesday, 28 November 2018 at 13:13:40 UTC, bauss wrote: Well unfortunately I cannot control the C++ side of things, but I assume that it'll work properly with extern(C++) so I guess I will just go ahead and try and see

Re: D & C++ class question

2018-11-28 Thread bauss via Digitalmars-d-learn
On Wednesday, 28 November 2018 at 10:44:05 UTC, Nicholas Wilson wrote: On Wednesday, 28 November 2018 at 07:22:46 UTC, bauss wrote: If I have a class from D. How would you use that class in C++? Like what's the correct approach to this. Would it work just by doing "extern(C++)" or will that

Re: How to center dlangui on screen

2018-11-28 Thread Edgar Huckert via Digitalmars-d-learn
On Wednesday, 28 November 2018 at 08:55:11 UTC, greatsam4sure wrote: I am learning Dlang and Dlangui. I encounter, a little problem on: how to center dlangui window on screen. How to set the window width and height outside the constructor How to maximize and minimize the window using code.

Re: LDC2 win64 calling convention

2018-11-28 Thread kinke via Digitalmars-d-learn
You're not using naked asm; this entails a prologue (spilling the params to stack etc.). Additionally, LDC doesn't really like accessing params and locals in DMD-style inline asm, see https://github.com/ldc-developers/ldc/issues/2854. You can check the final asm trivially online, e.g.,

LDC2 win64 calling convention

2018-11-28 Thread realhet via Digitalmars-d-learn
Hi, Is there a documentation about the win64 calling convention used with LDC2 compiler? So far I try to use the Microsoft x64 calling convention, but I'm not sure if that's the one I have to. But it's not too accurate becaues I think it uses the stack only.

Re: LDC2 win64 calling convention

2018-11-28 Thread kinke via Digitalmars-d-learn
On Wednesday, 28 November 2018 at 18:56:14 UTC, realhet wrote: 1. Is there register parameters? (I think no) Of course, e.g., POD structs of power-of-2 sizes <= 8 bytes and integral scalars as well as float/double/vectors. The stack isn't used at all, aggregates > 8 bytes are passed by ref

Re: LDC2 win64 calling convention

2018-11-28 Thread kinke via Digitalmars-d-learn
On Wednesday, 28 November 2018 at 20:17:53 UTC, kinke wrote: The stack isn't used at all To prevent confusion: it's used of course, e.g., if there are more than 4 total parameters. Just not in the classical sense, i.e., a 16-bytes struct isn't pushed directly onto the stack, but the caller

Re: LDC2 win64 calling convention

2018-11-28 Thread realhet via Digitalmars-d-learn
Thank You for the explanation! But my tests has different results: void* SSE_sobelRow(ubyte* src, ubyte* dst, size_t srcStride){ asm{ push RDI; mov RAX, 0; mov RDX, 0; mov RCX, 0; //clear 'parameter' registers mov RAX, src; mov RDI, dst; //gen movups XMM0,[RAX]; movaps

How to debug FinalizeError?

2018-11-28 Thread unDEFER via Digitalmars-d-learn
Hello! After long-long time of debugging, I just have decided InvalidMemoryOperationError in my program. But now my program after few hours of testing again crashes with "Finalization error". What this error means exactly? I again did something wrong in destructor? And how to debug it? I

Re: derelict-sdl2 automatically stripping the SDL_ prefix from names

2018-11-28 Thread unDEFER via Digitalmars-d-learn
Hello, as I know allMembers returns members not recursively. If you want to get really all members you need to make recursive function. In my program I used the next routine to print all members of module: static void allMembersOfModule(string module_name, bool root=false)() { static if

Re: How to center dlangui Window on screen

2018-11-28 Thread greatsam4sure via Digitalmars-d-learn
On Wednesday, 28 November 2018 at 17:23:21 UTC, Edgar Huckert wrote: On Wednesday, 28 November 2018 at 08:55:11 UTC, greatsam4sure wrote: I am learning Dlang and Dlangui. I encounter, a little problem on: how to center dlangui window on screen. How to set the window width and height outside

Re: How to debug FinalizeError?

2018-11-28 Thread Adam D. Ruppe via Digitalmars-d-learn
On Wednesday, 28 November 2018 at 22:40:17 UTC, unDEFER wrote: Hello! After long-long time of debugging, I just have decided InvalidMemoryOperationError in my program. But now my program after few hours of testing again crashes with "Finalization error". So InvalidMemoryOperationError means

Re: How to center dlangui Window on screen

2018-11-28 Thread greatsam4sure via Digitalmars-d-learn
On Wednesday, 28 November 2018 at 17:23:21 UTC, Edgar Huckert wrote: On Wednesday, 28 November 2018 at 08:55:11 UTC, greatsam4sure wrote: I am learning Dlang and Dlangui. I encounter, a little problem on: how to center dlangui window on screen. How to set the window width and height outside