Re: How do I compile D code for WASM? Any alternative runtime recommendations?

2024-08-29 Thread solidstate1991 via Digitalmars-d-learn
On Wednesday, 28 August 2024 at 19:43:53 UTC, Sergey wrote: No, many of them on the Discord.. Your game with raylib + wasm example also in the list of links :) Regardless, I will add them to the wiki, which is easier to search and access than a service primarily designed for chat.

Default struct constructors if a struct member is a union

2024-06-29 Thread solidstate1991 via Digitalmars-d-learn
```d union U { int i32; long i64; float f32; double f64; } struct S { TypeEnum type; U data; } S foo0 = S(TypeEnum.Integer32, S(20)); //Ugly, but works S foo1 = S(TypeEnum.Integer64, S(20L)); //Error: cannot implicitly convert expression //ditto for the rest of the mem

Re: How do I install a non-outdated D compiler on Linux? (not in userspace-container)

2024-06-08 Thread solidstate1991 via Digitalmars-d-learn
On Saturday, 8 June 2024 at 03:36:05 UTC, bachmeier wrote: For Mint, I'd use the .deb and let it handle that stuff. For LDC, I have a bash alias for ldmd2 that points to the ldmd2 binary. Of course there are multiple ways to handle this, but I don't understand the point of the install script, s

Re: How do I install a non-outdated D compiler on Linux? (not in userspace-container)

2024-06-07 Thread solidstate1991 via Digitalmars-d-learn
On Friday, 7 June 2024 at 23:19:37 UTC, solidstate1991 wrote: I **need** to link against various system libraries, and otherwise some tools won't be able to access the D compiler unless I start them from a command line after an initialization script. I'm using Linux Mint, it's much more stabl

How do I install a non-outdated D compiler on Linux? (not in userspace-container)

2024-06-07 Thread solidstate1991 via Digitalmars-d-learn
I **need** to link against various system libraries, and otherwise some tools won't be able to access the D compiler unless I start them from a command line after an initialization script. I'm using Linux Mint, it's much more stable than Ubuntu (which started to completely collapse on me for

Re: Anybody know about SDL and particularly SDL_TTF initialization?

2024-06-07 Thread solidstate1991 via Digitalmars-d-learn
On Sunday, 12 May 2024 at 20:13:04 UTC, WhatMeWorry` wrote: This should be trivial, right? I've been looking at existing D repo code for hours. Can't figure why TTF_Init doesn't work? It would help if I could figure out how to use SDL_GetError() INFO: SDL loaded v2.30.2 INFO: SDL initialized:

Re: How does one attach a manifest file to a D executable on Windows?

2024-06-02 Thread solidstate1991 via Digitalmars-d-learn
On Sunday, 2 June 2024 at 19:11:10 UTC, solidstate1991 wrote: Added a few more line to my `resources.rc` file, it seems like the issue is the resource file not being touched at all. I've put `dflags "resources.res" platform="windows"` in my `dub.sdl` file, it doesn't even care if there's a t

Re: How does one attach a manifest file to a D executable on Windows?

2024-06-02 Thread solidstate1991 via Digitalmars-d-learn
On Saturday, 25 May 2024 at 19:51:25 UTC, John Chapman wrote: Not tested but from memory I do this: 1) Copy that first XML snippet from the page you linked, save to a file called example.exe.manifest 2) Create a resource script file called resources.rc, with this at the top: 1 24 "example

Re: How does one attach a manifest file to a D executable on Windows?

2024-06-02 Thread solidstate1991 via Digitalmars-d-learn
On Saturday, 25 May 2024 at 19:51:25 UTC, John Chapman wrote: Not tested but from memory I do this: 1) Copy that first XML snippet from the page you linked, save to a file called example.exe.manifest 2) Create a resource script file called resources.rc, with this at the top: 1 24 "example.

Re: How does one attach a manifest file to a D executable on Windows?

2024-05-25 Thread solidstate1991 via Digitalmars-d-learn
On Friday, 24 May 2024 at 21:26:12 UTC, Ferhat Kurtulmuş wrote: I think this is what you need https://github.com/aferust/doitlater/tree/master/views/res No, I meant something like this: https://learn.microsoft.com/en-us/windows/win32/controls/cookbook-overview

Struct value either resets, or not getting passed correctly

2023-11-19 Thread solidstate1991 via Digitalmars-d-learn
https://github.com/ZILtoid1991/pixelperfectengine/blob/ed93bec15deea042516615e73c57d137a2c1f762/pixelperfectengine/src/pixelperfectengine/scripting/lua.d#L98 Struct `LuaVar` seems to work for the most part, however, at certain point, the value seems to be reset to zero, or not being passed to t

Re: Visual Studio 2022 no longer debugs D program, need an alternative debugger for Windows

2023-08-26 Thread solidstate1991 via Digitalmars-d-learn
On Saturday, 26 August 2023 at 17:57:22 UTC, jmh530 wrote: You should report this to bugzilla. I'm using it in an unusual way. Since VisualD does not support dub, I have to rely on VSCode as my main editor, then load the executable in an empty C++ project in VS. This worked so far. On the o

How can I restrict a library to be only included under a certain OS?

2023-03-28 Thread solidstate1991 via Digitalmars-d-learn
I added this line to my SDLang formatted dub build file: ``` dependency "libx11" version="0.0.1" platform="posix" ``` Yet it's included even on Windows, even if I change it to "linux". Since there's a fatal bug in the library that disallows it to be built, I'll be leaving it out for now, and i

Re: Using Windbg to debug D applications and unittests

2023-02-25 Thread solidstate1991 via Digitalmars-d-learn
On Saturday, 25 February 2023 at 19:55:27 UTC, evilrat wrote: Nothing happens without a reason, check your project settings and make sure that for debugging you have correct paths, command, and arguments. Even with no debug info and no project you can just drop an executable to an empty VS wi

Re: Using Windbg to debug D applications and unittests

2023-02-25 Thread solidstate1991 via Digitalmars-d-learn
On Saturday, 25 February 2023 at 18:08:57 UTC, evilrat wrote: Turn on exception settings panel in top menu bar: Debug->Windows->Exceptions Settings (Crtl+Alt+E) My settings for D is full "D exceptions", under Win32 check "D Exception", or just click "Restore to default settings" in there on

Re: Using Windbg to debug D applications and unittests

2023-02-25 Thread solidstate1991 via Digitalmars-d-learn
On Saturday, 25 February 2023 at 16:22:49 UTC, evilrat wrote: VisualD for Visual Studio provides some extra help with displaying your data in debugger and on Windows is the best you can get for D. You can use Visual Studio Code + code-d to debug, but it is not as good as full Visual Studio co

Using Windbg to debug D applications and unittests

2023-02-25 Thread solidstate1991 via Digitalmars-d-learn
I had a lot of trouble trying to get Visual Studio to catch handled exceptions, which would have been mandatory for debugging unittests, but I either forgot how to do it, or something have changed in either the newer versions of VS or the D compilers I use (LDC, DMD). So I downloaded the new

Re: How can I get the "owner" of a method?

2022-10-01 Thread solidstate1991 via Digitalmars-d-learn
On Friday, 30 September 2022 at 22:20:06 UTC, Salih Dincer wrote: Maybe this will help you: ```d template Bar(T) { void fun() {} } class Foo(T) { mixin Bar!T b; alias fun = b.fun; void test() { fun(); } } ``` SDB@79 The issue with that is in that case is instead of writing bo

How can I get the "owner" of a method?

2022-09-30 Thread solidstate1991 via Digitalmars-d-learn
Let's say I have a class or an interface with a function, and I want to pass that to a template to generate another function (in this case one that passes it to a scripting engine, and allows it to be called from there). Currently I have the following issues: 1. I have to pass the class/inter

Why this function just decides to not call another function and do its thing instead?

2022-09-17 Thread solidstate1991 via Digitalmars-d-learn
Code found here: https://github.com/ZILtoid1991/newxml/blob/main/source/newxml/domimpl.d#L1984 Even changing the code to this: ```d auto res = firstAttr; while (res) { if (res.localName != localName || res.namespaceURI != namespaceURI) res = res._nextAttr;

Is it valid in D to write an opSlice overload that takes no arguments?

2022-09-11 Thread solidstate1991 via Digitalmars-d-learn
Here's this code: ```d auto opSlice() { struct Range { Attr currentAttr; auto front() { return currentAttr; } void popFront() { currentAttr = currentAttr._nextAttr; } bool empty() { return currentAttr is null; } } return Range(firstAttr); } ``` Th

Re: Tracing out error that causes compiler crash

2022-09-04 Thread solidstate1991 via Digitalmars-d-learn
I tried to compile on the Raspberry Pi 400, now I'm getting segmentation fault during compilation with LDC. Still no idea what causes it, nor how to reduce it. Moved the codebase to a new repository, gave it a proper DOMString implementation instead of using it as a template name, and I'm still

Re: Tracing out error that causes compiler crash

2022-09-04 Thread solidstate1991 via Digitalmars-d-learn
On Sunday, 4 September 2022 at 08:17:13 UTC, Nick Treleaven wrote: You may be able to use dustmite to automatically reduce the code to a minimal test case: https://dlang.org/blog/2020/04/13/dustmite-the-general-purpose-data-reduction-tool/ Send my regards to the planet smasher. What do I pass

Tracing out error that causes compiler crash

2022-09-03 Thread solidstate1991 via Digitalmars-d-learn
During unittest in my own fork of std.experimental.xml (link: https://github.com/ZILtoid1991/experimental.xml ), potentially an error so severe is present, that it causes to crash the compiler (both DMD and LDC2, on Windows). I was able to separate the issue by commenting out all unittests, the

Re: Window created with Windows API is not visible

2022-06-20 Thread solidstate1991 via Digitalmars-d-learn
It seems I solved most of the problems by modifying event handling. I'll continue solving further ones and adding more functionality.

Re: Window created with Windows API is not visible

2022-06-18 Thread solidstate1991 via Digitalmars-d-learn
On Saturday, 18 June 2022 at 22:46:45 UTC, rikki cattermole wrote: registeredClass.style = 32_769; Don't use an integer like that, stick with bit wise ors. LPCWSTR classname = toUTF16z(name); GC owned memory, that could result in surprises. const LPWSTR windowname = toUTF16z(title); Ditt

Re: Window created with Windows API is not visible

2022-06-18 Thread solidstate1991 via Digitalmars-d-learn
On Saturday, 18 June 2022 at 21:33:31 UTC, Vinod K Chandran wrote: It seems that you are created a layered window. So chances are there to it become translucent. Did not set the flags for the layered window style, so I don't know. Might be an event processing error, since in Windows it's a

Window created with Windows API is not visible

2022-06-18 Thread solidstate1991 via Digitalmars-d-learn
Code: https://github.com/ZILtoid1991/iota/blob/main/inputtest/app.d https://github.com/ZILtoid1991/iota/blob/main/source/iota/window/base.d#L104 Second one contains the constructor that should make the window without any issues. When I try to create a window for testing purposes, I get nothi

Re: Thread exits immediately with no reason.

2021-12-21 Thread solidstate1991 via Digitalmars-d-learn
On Tuesday, 21 December 2021 at 19:00:01 UTC, solidstate1991 wrote: Well, it seems like it's an error on the WASAPI side. I totally disabled error handling (including the switch-case thingy), then GetBuffer returns with an error code indicating buffer is too large. The solution was to call `R

Re: Thread exits immediately with no reason.

2021-12-21 Thread solidstate1991 via Digitalmars-d-learn
Well, it seems like it's an error on the WASAPI side. I totally disabled error handling (including the switch-case thingy), then GetBuffer returns with an error code indicating buffer is too large.

Re: Thread exits immediately with no reason.

2021-12-21 Thread solidstate1991 via Digitalmars-d-learn
On Tuesday, 21 December 2021 at 01:13:10 UTC, Ali Çehreli wrote: I bet it's throwing an Error. Call your thread entry function from a try-catch wrapping function to see whether that's the case: // Rename existing function: protected void audioThreadImpl() @nogc nothrow { // ... } // New fun

Thread exits immediately with no reason.

2021-12-20 Thread solidstate1991 via Digitalmars-d-learn
Here's this function, which serves as a thread entry point: https://github.com/ZILtoid1991/iota/blob/main/source/iota/audio/wasapi.d#L220 The problem is, that even with disabling all error-handling that would allow to shut down the thread safely, the thread only runs that while loop once. Ho

How can I check a newly set ref value

2021-10-23 Thread solidstate1991 via Digitalmars-d-learn
Let's say I have something like this: ``` struct Foo { int[] bar; this() { bar.length = 10; } ref int opIndex(size_t i) { return bar[i]; } } void main() { Foo f = Foo(); f[3] = 15; } ``` If I wanted to check whether the assigned value is within a rang

Re: std.format doesn't want to work

2021-10-17 Thread solidstate1991 via Digitalmars-d-learn
On Sunday, 17 October 2021 at 13:03:46 UTC, jfondren wrote: then it's likely that some memory corruption prior to format() has broken the GC, and format's allocation of a string is what's failing. Try sprinkling `@safe` and and see what it complains about; try valgrind; try reducing your proble

Re: std.format doesn't want to work

2021-10-17 Thread solidstate1991 via Digitalmars-d-learn
On Sunday, 17 October 2021 at 05:22:17 UTC, russhy wrote: On Saturday, 16 October 2021 at 22:47:09 UTC, solidstate1991 wrote: When I make this call ``` format(" %3.3f"w, avgFPS); ``` my program immediately crashes with an access violation error. The debugger out is different between x86 and x86

std.format doesn't want to work

2021-10-16 Thread solidstate1991 via Digitalmars-d-learn
When I make this call ``` format(" %3.3f"w, avgFPS); ``` my program immediately crashes with an access violation error. The debugger out is different between x86 and x86-64. I've made all sanity checks, so I need some other suggestions.

Registering-unregistering threads

2021-07-30 Thread solidstate1991 via Digitalmars-d-learn
I'm doing some audio-related work, and one thing I need is to unregister from (and maybe later temporarily re-register to) the GC, since it would cause some issues, and it would be nice if I still could use the GC during disk operations, etc. Info on it is quite scarce and a bit confusing. If

Re: Unknown bug disallows growth of dynamic arrays

2021-07-01 Thread solidstate1991 via Digitalmars-d-learn
On Monday, 28 June 2021 at 20:55:44 UTC, solidstate1991 wrote: Here's the offending function: https://github.com/ZILtoid1991/collections-d/blob/master/source/collections/sortedlist.d#L38 It causes to throw an exception with `Access violation reading location` and a memory address, int the func

Unknown bug disallows growth of dynamic arrays

2021-06-28 Thread solidstate1991 via Digitalmars-d-learn
Here's the offending function: https://github.com/ZILtoid1991/collections-d/blob/master/source/collections/sortedlist.d#L38 It causes to throw an exception with `Access violation reading location` and a memory address, int the function `_d_arraysetlengthT`. Variable `ti` is a TypeInfo_Array, `

Re: How to specify an exact template?

2021-01-16 Thread solidstate1991 via Digitalmars-d-learn
Well, it's quite complicated to do. I have to manually unwrap each and all function template, then pray for the compile-time optimization gods that they'll be inlined. This is so annoying, that I might issue a DIP...

Re: How to specify an exact template?

2021-01-16 Thread solidstate1991 via Digitalmars-d-learn
On Saturday, 16 January 2021 at 14:18:55 UTC, Tove wrote: probably you can use https://dlang.org/spec/traits.html#getOverloads I don't know how to use it with functions outside of structs/classes.

Re: How to specify an exact template?

2021-01-16 Thread solidstate1991 via Digitalmars-d-learn
On Saturday, 16 January 2021 at 14:13:29 UTC, solidstate1991 wrote: Here's the following line, among many others: return &alphaBlend32bitMV!(ubyte); This generates an error, as this function template matches two instances, but currently I don't know how to choose the one I need, other than wr

How to specify an exact template?

2021-01-16 Thread solidstate1991 via Digitalmars-d-learn
Here's the following line, among many others: return &alphaBlend32bitMV!(ubyte); This generates an error, as this function template matches two instances, but currently I don't know how to choose the one I need, other than write a local function, that looks a bit ugly.

Re: opApply and attributes

2020-07-16 Thread solidstate1991 via Digitalmars-d-learn
On Tuesday, 14 July 2020 at 00:17:14 UTC, solidstate1991 wrote: Something like that, but with @safe, pure, etc. attributes. I've tried to "bruteforce" it by generating functions with combinations of attributes, and it kinda works, but is a very janky solution. I'll brainstorm some DIP to fi

Re: opApply and attributes

2020-07-13 Thread solidstate1991 via Digitalmars-d-learn
On Tuesday, 7 July 2020 at 20:53:05 UTC, Ali Çehreli wrote: I am not sure whether I understand it correctly but there has been a request for opApply() to gain the attributes of the delegate (or the range?). In other words, "transfer the attributes to opApply". This is needed because I want opAp

Re: opApply and attributes

2020-07-07 Thread solidstate1991 via Digitalmars-d-learn
On Tuesday, 7 July 2020 at 13:33:41 UTC, Paul Backus wrote: You can make opApply a template: int opApply(Dg)(Dg dg) if (is(Dg : scope int delegate(ref E))) { // etc. } Because `scope int delegate(ref E) @safe` implicitly converts to `scope int delegate(ref E)`, thi

opApply and attributes

2020-07-06 Thread solidstate1991 via Digitalmars-d-learn
See implementation of data structure here: https://github.com/ZILtoid1991/collections-d/blob/master/source/collections/treemap.d#L565 If I try to compile this code, it'll fail, limiting it's usecase: @safe pure unittest { alias IntMap = TreeMap!(int, int, false); IntMap test;

Re: A custom name for variables

2020-05-29 Thread solidstate1991 via Digitalmars-d-learn
On Thursday, 28 May 2020 at 20:26:55 UTC, Quantium wrote: I need to create a variable with custom name, like this import std; void main() { string name; readf(" %s", &name); // some code that generates a variable of type integer and value 0 } Could you help me with that? This migh

Re: Linker error under Ubuntu

2020-05-15 Thread solidstate1991 via Digitalmars-d-learn
On Friday, 15 May 2020 at 03:46:57 UTC, evilrat wrote: Um, pardon the stupid question, but did you just forgot to link it? I can't see a mention of it anywhere in both the old json and dub.sdl, and I don't see subpackages either. (does it links implicitly by the compiler?) Also if it's digg

Linker error under Ubuntu

2020-05-14 Thread solidstate1991 via Digitalmars-d-learn
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' //lib/x86_64-linux-gnu/libz.so.1: error adding symbols: DSO missing from command line collect

Re: Fixing race issues the right way

2020-04-20 Thread solidstate1991 via Digitalmars-d-learn
On Sunday, 5 April 2020 at 22:33:50 UTC, Stefan Koch wrote: Look at your program in a debugger and see if it does spawn threads. If it does find out where and why they are spawned. Thanks for the answer, but it seems the issue was the lack of the ability of unittesting such a large package.

Fixing race issues the right way

2020-04-05 Thread solidstate1991 via Digitalmars-d-learn
My game engine is currently broken due to some race issue I don't really know how to resolve. It seems that the compiler tries to skip instructions that are not locked with a `writeln()` or something similar. Usually I can safely remove the writeln after compiling it once with that way. Howev

Re: How to debug in vscode Windows?

2020-01-01 Thread solidstate1991 via Digitalmars-d-learn
On Wednesday, 1 January 2020 at 14:46:01 UTC, NaN wrote: You can use visual studio (works in 2019, havent tried earlier versions) to debug any exe you want. You do this... Go to File menu, then Open, then Project/Solution Make sure "all project files" is selected, then find the exe you want t

LLD-link doesn't work, how do I change linkers?

2020-01-01 Thread solidstate1991 via Digitalmars-d-learn
I cannot do any work, since LLD-link is broken and doesn't want to link for anything. It just gives me a bunch of errors for missing symbols, that supposed to be in the core libraries. How can I set up the Microsoft linker instead?

"Mixin is not defined" error when trying to use template mixins

2019-10-27 Thread solidstate1991 via Digitalmars-d-learn
There's a template mixin in my dimage project's new version in base.d, and when I try to access it from another file I get two errors: undefined identifier `ChunkyAccess4bit`, did you mean template `ChunkyAccess4Bit()`? and mixin `dimage.tga.TGA.ChunkyAccess4bit!()` is not defined Should I

Any easy way to check if an object have inherited an interface?

2019-07-22 Thread solidstate1991 via Digitalmars-d-learn
It seems that I've to write my own function that searches in the given object's classinfo.interfaces since I couldn't find anything related in Phobos.

Re: std.zlib odd behavior

2019-05-20 Thread solidstate1991 via Digitalmars-d-learn
On Wednesday, 6 March 2019 at 01:50:16 UTC, solidstate1991 wrote: Thanks, it seems I'll have to write my own solution for this, and I really dislike the way streaming compression works in C. I've spotted some other bugs regarding my PNG implementation, but those were unrelated and didn't improv

Re: std.zlib odd behavior

2019-03-05 Thread solidstate1991 via Digitalmars-d-learn
On Tuesday, 5 March 2019 at 02:19:26 UTC, Adam D. Ruppe wrote: I haven't found the bug in your code yet, but one thing I suspect from my experience is you might be reusing a buffer. std.zlib actually stores pointers internally across function calls, so if you are trying to compress a stream, yo

std.zlib odd behavior

2019-03-04 Thread solidstate1991 via Digitalmars-d-learn
https://github.com/ZILtoid1991/dimage/blob/master/source/dimage/png.d It seems that after a certain point, it doesn't add more data to the compression stream, flushing doesn't help.

Re: Odd behavior of darray.dup

2019-02-23 Thread solidstate1991 via Digitalmars-d-learn
On Saturday, 23 February 2019 at 19:21:10 UTC, Bastiaan Veelo wrote: It works for me: https://run.dlang.io/gist/473b0021487275751accaebeb00be05c -- Bastiaan Still no luck, not even with memcpy. There's even more mystery as I printed out the original static immutable array's content, which i

Odd behavior of darray.dup

2019-02-22 Thread solidstate1991 via Digitalmars-d-learn
If I want to copy an array of structs with .dup (cannot post the link in question here at the moment due to non-working clipboard, it's Color from pixelperfectengine.graphics.common) I get all zeroes instead of the values from the original array. I haven't disabled post-blit to my knowledge.

Where to start with SafeD?

2019-02-13 Thread solidstate1991 via Digitalmars-d-learn
When I tried to apply to a position at Symmetry, I've got a criticism from Atila Neves that some of my code relied too much on memcpy, thus making it unsafe. After digging into std.array, I found some function that could possibly replace it to emulate writing in the middle of a file, but at lea

Should this library binding work?

2018-12-26 Thread solidstate1991 via Digitalmars-d-learn
https://github.com/ZILtoid1991/bindbc-zstandard After looking for alternatives to my megaproject of porting LZHAM to D (since it had several issues, I'll salvaging my tar implementation as well as another archive format meant for application data storage), I found out that zstandard not only

Template matches more than one template declaration error when trying to pass function's pointer

2018-11-30 Thread solidstate1991 via Digitalmars-d-learn
After some refactoring, there are four functions sharing the same name (technically four, but LDC didn't complain about them): @nogc void blitter(T)(T* src, T* dest, size_t length){...} and @nogc void blitter(T)(T* src, T* dest, size_t length, T* mask){...} I need the first one, but at comp

Can opApply be made @nogc?

2018-10-19 Thread solidstate1991 via Digitalmars-d-learn
Since it's a bit difficult to make tree traversal through range (especially if someone wants to make it @nogc), I thought I'll make it through opApply override, however the delegate passed by it doesn't have the @nogc attribute, which would automatically make it incapable to be used in a @nogc

Interfacing D with C++ functions that take reference values

2018-10-03 Thread solidstate1991 via Digitalmars-d-learn
I need some C++ stuff, but some of the functions take reference values (Stuff&), and I don't know if this feature is emulated on D side with extern(C++) functions. While I don't have to worry about it with functions that are defined in the header, other ones and classes are a different matter.

Using fibers

2018-08-03 Thread solidstate1991 via Digitalmars-d-learn
I'm porting LZHAM to D, and the original used some very unusual approach for coroutines: - the whole thing is running inside of a single switch-case block created by C++ macros - the function saves some local values - a macro sets the state variable to the current line number, returns the st

Casting a pointer and length value as a dynamic array

2018-07-30 Thread solidstate1991 via Digitalmars-d-learn
I need this to port a C++ code to D (a compression algorithm known as LZHAM), and the easiest way to deal with it would be that. The ADLER32 and CRC32 algorithms had to be ditched, and while I could rewrite the former to make sense (used some form of "vectorization") I would like to use the sta

Re: Using an external Assembler with D

2018-04-25 Thread solidstate1991 via Digitalmars-d-learn
On Wednesday, 25 April 2018 at 15:25:42 UTC, Stefan Koch wrote: Pass stuff on the stack ;) and use extern (C) functions. Thanks! What about extern (D)? Is there a big chaos in the D ABI under x86?

Using an external Assembler with D

2018-04-24 Thread solidstate1991 via Digitalmars-d-learn
In order to make one of my own code more readable (and hopefully to avoid a lot of compiling errors under LDC, which don't happen in DMD for some reason), I'm planning to put my assembly functions into separate files for each system that needs them, mainly due to the lack of proper SIMD support

Better multithreading with D

2018-04-20 Thread solidstate1991 via Digitalmars-d-learn
In order to call a function multiple time at parallel (rendering function, very well parallelizable), but in order to push the CPU to it's limits I have to get some form of parallelization. Currently I'm using parallel foreach, which isn't very nice, and since it uses GC allocation that creates

Re: Game and GC

2018-04-08 Thread solidstate1991 via Digitalmars-d-learn
On Monday, 9 April 2018 at 01:01:18 UTC, Chris Katko wrote: Why... associative arrays? Wouldn't that become expensive when you hit 1,000s, or 10,000's of objects, for something as tiny as a coordinate (two or three floats) lookup? Well, that's the other reason why I was looking for a different

Checking if a function pointer is set or null

2018-04-08 Thread solidstate1991 via Digitalmars-d-learn
Would the if(!(myFunctionPointer is null)){} work is I intended?

Re: Game and GC

2018-04-08 Thread solidstate1991 via Digitalmars-d-learn
On Saturday, 24 February 2018 at 07:12:21 UTC, Guillaume Piolat wrote: From my experience a combination of the following is necessary: - not having the audio thread registered - using pools aggressively for game entities Also you can save a lot of clockcycles if you put @nogc everywhere you do

Re: Issues using the in-line assembler

2018-04-05 Thread solidstate1991 via Digitalmars-d-learn
Seems I found a better solution hidden in the docs: @nogc protected int[2] transformFunc(int[2] xy){ version(X86){ asm @nogc{ naked; mov EBX, this; movdXMM1, sX[EBX]; pslldq XMM1, 4; movss XMM1, sY[EBX];

Re: Issues using the in-line assembler

2018-04-05 Thread solidstate1991 via Digitalmars-d-learn
On Thursday, 5 April 2018 at 04:48:02 UTC, Basile B. wrote: The "this" seems to be in R11, so you have to apply the asm syntax for accessing the members using .offsetof.[R11], example: ``` class Foo { double a = 123456; extern(D) double foo() { asm { nak

Re: Issues using the in-line assembler

2018-04-04 Thread solidstate1991 via Digitalmars-d-learn
I forgot to tell, that xy0 ac, and bd are local to the class.

Issues using the in-line assembler

2018-04-04 Thread solidstate1991 via Digitalmars-d-learn
I have this code: asm @nogc{ movqXMM0, xy; paddd XMM0, sXY; // xy + sXY movqXMM3, xy0; psubd XMM0, XMM3; // xy + sXY - x0y0 movqXMM1, ac; movqXMM2, bd; pmuludq

Re: Alias on an array element

2017-10-12 Thread solidstate1991 via Digitalmars-d-learn
On Friday, 13 October 2017 at 01:09:56 UTC, solidstate1991 wrote: I'm making a struct for easy color handling Here's a code sample: ublic struct Color{ union{ uint raw; ///Raw representation in integer form, also forces the system to align in INT32. ubyte[4] colors; ///Normal repre

Alias on an array element

2017-10-12 Thread solidstate1991 via Digitalmars-d-learn
I'm making a struct for easy color handling Here's a code sample: ublic struct Color{ union{ uint raw; ///Raw representation in integer form, also forces the system to align in INT32. ubyte[4] colors; ///Normal representation, aliases are used for color naming. ubyt

How to use encode and decode of std.utf

2017-09-09 Thread solidstate1991 via Digitalmars-d-learn
There's not much deep documentation about the functions, and I'm interested if it can decode into UTF16 from UTF8.

Re: D is Multiplatform[DUVIDA]

2017-09-09 Thread solidstate1991 via Digitalmars-d-learn
On Friday, 8 September 2017 at 05:13:18 UTC, dark777 wrote: On Friday, 8 September 2017 at 03:56:25 UTC, rikki cattermole wrote: On 08/09/2017 3:08 AM, dark777 wrote: On Friday, 8 September 2017 at 00:09:08 UTC, solidstate1991 wrote: On Thursday, 7 September 2017 at 23:58:05 UTC, dark777 wrote

Re: D is Multiplatform[DUVIDA]

2017-09-07 Thread solidstate1991 via Digitalmars-d-learn
On Thursday, 7 September 2017 at 23:58:05 UTC, dark777 wrote: Good night, did you want to know this? Is the DE language cross-platform or cross-compile like C ++? GDC and LDC has multi-platform support, I'm currently working on an ARM backend for DMD.

Re: 24-bit int

2017-09-02 Thread solidstate1991 via Digitalmars-d-learn
On Friday, 1 September 2017 at 19:39:14 UTC, EntangledQuanta wrote: Is there a way to create a 24-bit int? One that for all practical purposes acts as such? This is for 24-bit stuff like audio. It would respect endianness, allow for arrays int24[] that work properly, etc. If you need to perfo

Re: How can I serialize a struct into a file in the style of C?

2017-07-22 Thread solidstate1991 via Digitalmars-d-learn
On Saturday, 22 July 2017 at 02:22:53 UTC, Mike Parker wrote: I should add, though, that you're better off using either std.stdio.File or std.file. Use the former if you need to make multiple reads/writes to a file, the latter if you can pull it in or push it out all in one go. They take arra

How can I serialize a struct into a file in the style of C?

2017-07-21 Thread solidstate1991 via Digitalmars-d-learn
Due to it's convenience, I was thinking on reading and writing file headers by creating structs mirroring the layouts of actual headers I would need. I've seen many examples of this in C, however I' struggling using the same methods through the use of code.stdc.stdio, especially as I can't real

Re: iOS Apps in D

2017-05-31 Thread solidstate1991 via Digitalmars-d-learn
On Wednesday, 31 May 2017 at 12:49:38 UTC, Oleksii wrote: Hi everybody, Perhaps this topic has been raised many times before, but I'm going to go back to it anyways :-P Are there any good reference materials and/or tutorials on programming for iOS and Android in D? I wonder if anybody could

Re: How to setup DLL and EXE projects in one VS solution

2017-05-17 Thread solidstate1991 via Digitalmars-d-learn
On Wednesday, 17 May 2017 at 16:56:13 UTC, Igor wrote: At the moment I have: EXEProject: app.d - it does loadlibrary of dllproj and uses data structures defined in dllproj.d (it imports dllproj). On the file system this file is under /platform/win32/ and is defined as module win32.app; DL

Re: ordered Associative array

2017-04-13 Thread solidstate1991 via Digitalmars-d-learn
On Friday, 14 April 2017 at 00:29:34 UTC, Jethro wrote: Is there a way to retain the ordering of an associative array? When the elements are added then looped over using a foreach, the order is different. Use a separate array to store the keys, order them all time when you add a new one, etc.

Re: Use of "T"

2017-04-12 Thread solidstate1991 via Digitalmars-d-learn
On Wednesday, 12 April 2017 at 16:05:23 UTC, XavierAP wrote: On Wednesday, 12 April 2017 at 14:46:20 UTC, solidstate1991 wrote: T is just the common name of a (type) parameter, mostly whenever the template is more generic that you can't think of a more informative (template) parameter name.

Re: Use of "T"

2017-04-12 Thread solidstate1991 via Digitalmars-d-learn
On Wednesday, 12 April 2017 at 13:54:11 UTC, qznc wrote: On Wednesday, 12 April 2017 at 13:17:42 UTC, solidstate1991 wrote: How can I make use of T? I've seen it being used many times for this application. What "T"? This letter is often used as a generic template parameter. Are you talking ab

Use of "T"

2017-04-12 Thread solidstate1991 via Digitalmars-d-learn
Some utilities of my game engine needs a two-way "dictionary", mainly for increasing the readability of configuration files, but I was thinking on letting the end-user to use it for certain things and I don't want to recreate the encode/decode/load from SDLang file functions every time I have t

Re: Problems with setting up dub for publication

2017-03-04 Thread solidstate1991 via Digitalmars-d-learn
Replaced all the ~> with ==, now I'm getting error from dub wanting to use the alpha versions of the derelict libraries, which have minor compatibility issues with my project.

Problems with setting up dub for publication

2017-03-04 Thread solidstate1991 via Digitalmars-d-learn
My graphics engine contains two subpackages currently: -PixelPerfectEngine (the engine itself) -PixelPerfectEditor (the editor/converter, uses the engine itself to display screen data) However, after I wrote the dub.json and try to compile it as a test, I get this output: Building package

Reading image files

2016-11-25 Thread solidstate1991 via Digitalmars-d-learn
After I couldn't figure out how to convert Imageformats' own format to my own (consequential read from IFImage resulted in a glitchy image after rendering the result) and I have no idea how DerelictFI works at all, I'm currently out of options. At least I need PNG and TGA (the latter is importa

Multi-threading how-to

2016-08-31 Thread solidstate1991 via Digitalmars-d-learn
I decided to write a shared library for OSC in D despite the lack of popularity. I decided to add a functionality that if multiple programs use the same instance of the library on the same computer, the messages will be passed directly instead of via networking. Unfortunately we barely touch

Is this a bug or I made some mistake?

2016-08-29 Thread solidstate1991 via Digitalmars-d-learn
Since I have some screenshots: https://twitter.com/EvilReptoid/status/770303804550021121 I needed a bitarray, that had some more capability than the one in std.bitmanip for collision detection. I could test a whole line with it at once if my predictions are right. However I couldn't do the ar

Using external libraries the correct way

2016-07-17 Thread solidstate1991 via Digitalmars-d-learn
Up to this day, I have to use them by dragging the source into my project. When I tried to import imageformats, the compiler looks up for the file imageformats.d and fails to finish the program. I'm not using command line for compiling, I use Xamarin with mono-D instead.

Creating a JSON file

2015-02-03 Thread solidstate1991 via Digitalmars-d-learn
I wrote my graphics engine with CodeBlocks, and I only used dub when I complied the derelict SDL2 libs. https://github.com/ZILtoid1991/VDP-engine You can find the sources here.