2d graphic and multimedia

2020-03-11 Thread Noor Wachid via Digitalmars-d-learn
I usually go with SFML (C++) library to write simple visualization. Is there any similiar library in D?

Re: DMD 2.090.1: SIGILL, Illegal instruction on (ahem) intel Pentium III

2020-03-11 Thread Johan via Digitalmars-d-learn
On Wednesday, 11 March 2020 at 22:18:04 UTC, kdevel wrote: On Thursday, 27 February 2020 at 19:24:39 UTC, Johan wrote: LDC will work fine if told what processor you have: https://d.godbolt.org/z/5hrzgm -m32 -mcpu=pentium3 (-mcpu=native should also work). When I "cross compile" on an AMD 64

Re: DMD 2.090.1: SIGILL, Illegal instruction on (ahem) intel Pentium III

2020-03-11 Thread kinke via Digitalmars-d-learn
On Wednesday, 11 March 2020 at 22:18:04 UTC, kdevel wrote: Disassembly on the AMD 64 it reveals that ldc also emits the movds instructions: 0x08051ba2 <+434>: call 0x804f680 <_D2rt5minfo11ModuleGroup6__ctorMFNbNcNiAyPS6object10ModuleInfoZSQCkQCkQCh> 0x08051ba7 <+439>: sub

Re: Referencing an image in .css file in vibe.d

2020-03-11 Thread GreatSam4sure via Digitalmars-d-learn
On Wednesday, 11 March 2020 at 22:11:24 UTC, GreatSam4sure wrote: I am trying to reference an image that is in public/imgs/pix1.jpg in CSS file using background-image using URL but the image does not show. What is the proper way of reference to the URL of the image? I will appreciate any

Re: DMD 2.090.1: SIGILL, Illegal instruction on (ahem) intel Pentium III

2020-03-11 Thread kdevel via Digitalmars-d-learn
On Thursday, 27 February 2020 at 19:24:39 UTC, Johan wrote: LDC will work fine if told what processor you have: https://d.godbolt.org/z/5hrzgm -m32 -mcpu=pentium3 (-mcpu=native should also work). When I "cross compile" on an AMD 64 Bit machine for pentium3 [AMD 64 bit] $ ldc2 -m32

Referencing an image in .css file in vibe.d

2020-03-11 Thread GreatSam4sure via Digitalmars-d-learn
I am trying to reference an image that is in public/imgs/pix1.jpg in CSS file using background-image using URL but the image does not show. What is the proper way of reference to the URL of the image? I will appreciate any help

Re: Typescript with vibe.d

2020-03-11 Thread GreatSam4sure via Digitalmars-d-learn
On Tuesday, 10 March 2020 at 08:55:56 UTC, Jacob Carlborg wrote: On Monday, 9 March 2020 at 09:42:16 UTC, GreatSam4sure wrote: I want to know if it is possible to use typescript with the vibe.d since typescript is a superset of javascript. I will appreciate any example if it is possible

Re: string to char* in betterC

2020-03-11 Thread 9il via Digitalmars-d-learn
On Wednesday, 11 March 2020 at 16:10:48 UTC, 9il wrote: On Wednesday, 11 March 2020 at 16:07:06 UTC, Abby wrote: What is the proper way to get char* from string which is used in c functions? toStringz does returns: /usr/include/dmd/phobos/std/array.d(965,49): Error: TypeInfo cannot be used

Re: string to char* in betterC

2020-03-11 Thread rikki cattermole via Digitalmars-d-learn
On 12/03/2020 5:07 AM, Abby wrote: What is the proper way to get char* from string which is used in c functions? toStringz does returns: /usr/include/dmd/phobos/std/array.d(965,49): Error: TypeInfo cannot be used with -betterC and I think string.ptr is not safe because it's not zero

Re: string to char* in betterC

2020-03-11 Thread 9il via Digitalmars-d-learn
On Wednesday, 11 March 2020 at 16:07:06 UTC, Abby wrote: What is the proper way to get char* from string which is used in c functions? toStringz does returns: /usr/include/dmd/phobos/std/array.d(965,49): Error: TypeInfo cannot be used with -betterC and I think string.ptr is not safe because

string to char* in betterC

2020-03-11 Thread Abby via Digitalmars-d-learn
What is the proper way to get char* from string which is used in c functions? toStringz does returns: /usr/include/dmd/phobos/std/array.d(965,49): Error: TypeInfo cannot be used with -betterC and I think string.ptr is not safe because it's not zero termined. So what should I do? realloc

Re: Aliases to mutable thread-local data not allowed [testable source code]

2020-03-11 Thread mark via Digitalmars-d-learn
On Wednesday, 11 March 2020 at 14:01:13 UTC, Simen Kjærås wrote: [snip] Yeah, I forgot we cast to immutable to be able to send, so receive has to receive immutable(Deb)*, after which you can call deb.dup to get a mutable copy: receive( (immutable(Deb)* deb) { debForName[deb.name]

Re: Aliases to mutable thread-local data not allowed [testable source code]

2020-03-11 Thread Simen Kjærås via Digitalmars-d-learn
On Wednesday, 11 March 2020 at 12:43:28 UTC, mark wrote: On Wednesday, 11 March 2020 at 12:22:21 UTC, Simen Kjærås wrote: On Wednesday, 11 March 2020 at 09:29:54 UTC, mark wrote: [snip] Fascinating. It works just fine when compiling for 32-bit targets with DMD on Windows, but not for 64-bit

External .o sources + BetterC : undefined symbol: __chkstk

2020-03-11 Thread SrMordred via Digitalmars-d-learn
I got undefined symbol: __chkstk when using some external .o sources ( compile with clang ) + betterC flag. I thought that __chkstk was present on ntdll.lib, so i added manually as a lib, but still didn´t work. How can i solve this? (it must be another lib that D includes since it works

Re: How to sort 2D Slice along 0 axis in mir.ndslice ?

2020-03-11 Thread jmh530 via Digitalmars-d-learn
On Wednesday, 11 March 2020 at 06:12:55 UTC, 9il wrote: [snip] Almost the same, just fixed import for `each` and a bit polished /+dub.sdl: dependency "mir-algorithm" version="~>3.7.18" +/ import mir.ndslice; import mir.ndslice.sorting; import mir.algorithm.iteration: each; void main() {

Re: Aliases to mutable thread-local data not allowed [testable source code]

2020-03-11 Thread mark via Digitalmars-d-learn
On Wednesday, 11 March 2020 at 12:22:21 UTC, Simen Kjærås wrote: On Wednesday, 11 March 2020 at 09:29:54 UTC, mark wrote: [snip] Fascinating. It works just fine when compiling for 32-bit targets with DMD on Windows, but not for 64-bit targets, nor when compiling with LDC. Apparently, this

Re: Aliases to mutable thread-local data not allowed [testable source code]

2020-03-11 Thread Simen Kjærås via Digitalmars-d-learn
On Wednesday, 11 March 2020 at 09:29:54 UTC, mark wrote: Hi Simen, I think you must have done something else but didn't mention to get it to compile. I did the exact changes you said and it wouldn't compile. Here's what I get with changes mentioned below (with new full source):

Re: Aliases to mutable thread-local data not allowed [solved-ish]

2020-03-11 Thread mark via Digitalmars-d-learn
I finally got a threaded version that works, and a lot more cleanly than using send/receive. (But performance is dismal, see the end.) Here's the heart of the solution: void readPackages() { import std.algorithm: max; import std.array: array; import

Re: How to sort 2D Slice along 0 axis in mir.ndslice ?

2020-03-11 Thread Pavel Shkadzko via Digitalmars-d-learn
On Wednesday, 11 March 2020 at 06:12:55 UTC, 9il wrote: On Wednesday, 11 March 2020 at 00:24:13 UTC, jmh530 wrote: [...] Almost the same, just fixed import for `each` and a bit polished /+dub.sdl: dependency "mir-algorithm" version="~>3.7.18" +/ import mir.ndslice; import

Re: Aliases to mutable thread-local data not allowed [testable source code]

2020-03-11 Thread mark via Digitalmars-d-learn
Hi Simen, I think you must have done something else but didn't mention to get it to compile. I did the exact changes you said and it wouldn't compile. Here's what I get with changes mentioned below (with new full source):

Re: Aliases to mutable thread-local data not allowed [testable source code]

2020-03-11 Thread Simen Kjærås via Digitalmars-d-learn
On Tuesday, 10 March 2020 at 20:03:21 UTC, mark wrote: I've managed to make a cut-down version that's < 170 LOC. It needs to be run on Debian or a Debian-based Linux (e.g., Ubuntu). Hopefully this will help someone understand and be able to help! This took some time figuring out. Turns out,

Re: How to sort 2D Slice along 0 axis in mir.ndslice ?

2020-03-11 Thread 9il via Digitalmars-d-learn
On Wednesday, 11 March 2020 at 00:24:13 UTC, jmh530 wrote: On Tuesday, 10 March 2020 at 23:31:55 UTC, p.shkadzko wrote: [snip] Below does the same thing as the numpy version. /+dub.sdl: dependency "mir-algorithm" version="~>3.7.18" +/ import mir.ndslice.sorting : sort; import

Re: std.bitmanip help - how to combine bitfields and read

2020-03-11 Thread kookman via Digitalmars-d-learn
On Wednesday, 11 March 2020 at 05:25:43 UTC, kookman wrote: I am using libpcap to read from stored pcap files, and want to use std.bitmanip.bitfields to read TCP flags from the file, using a struct like: struct TcpHeader { align(1): ushort srcPort; ushort dstPort; uint seqNo;