Re: Using DUB packages with Meson
On Thursday, 27 April 2023 at 20:48:45 UTC, Richard (Rikki) Andrew Cattermole wrote: On 28/04/2023 1:43 AM, Denis Feklushkin wrote: On Wednesday, 12 April 2023 at 10:06:22 UTC, Dmitry Olshansky wrote: And I did fetch & build What are possible ways to automate such download? Meson knows exactly which versions of packages suit to build. Is it possible, for example, to get somehow packages list and then download using dub fetch? On dubs end yes, and yes. $ dub build package@version I guess I didn't express myself that way How to get list of packages that can be passed to DUB by this way as above?
Re: Using DUB packages with Meson
On Wednesday, 12 April 2023 at 10:06:22 UTC, Dmitry Olshansky wrote: And I did fetch & build What are possible ways to automate such download? Meson knows exactly which versions of packages suit to build. Is it possible, for example, to get somehow packages list and then download using dub fetch?
Re: This is bug or not? (immutable class containing struct with dtor)
On Saturday, 18 December 2021 at 12:50:17 UTC, Tejas wrote: As Ali said, this is an implementation issue. So I guess the answer to your question is that this is a bug. Please file a report at [issues.dlang.org](issues.dlang.org) Looks like this is same case: https://issues.dlang.org/show_bug.cgi?id=13628
Re: This is bug or not? (immutable class containing struct with dtor)
On Friday, 17 December 2021 at 19:03:05 UTC, Tejas wrote: Well, I got completely mislead by my experiment ```d struct S { ~this() immutable {} } ``` Interesting what discussed behaviour isn't affects method what implements same functionality as dtor and called explictly at each appropriate place. So for dirty fix I just created ```d void __custom_dtor() const { ... } ``` And then called this __custom_dtor at each dtor what uses this struct.
Re: This is bug or not? (immutable class containing struct with dtor)
On Friday, 17 December 2021 at 18:02:52 UTC, Tejas wrote: I improved your sample: ```d immutable struct S { ~this() {} } immutable struct S2 { S sss; ~this() {} } void main() { S2 s = S2(); } ``` ``` Error: `immutable` method `serializer_bug.S.~this` is not callable using a mutable object Error: mutable method `serializer_bug.S2.~this` is not callable using a `immutable` object serializer_bug.d(17,5):Consider adding `const` or `inout` here ``` immutable dtor can't be called at all?
Re: This is bug or not? (immutable class containing struct with dtor)
On Friday, 17 December 2021 at 18:01:03 UTC, Tejas wrote: I think since `immutable` objects are kept in Read Only Storage Some of them can be stored in ROM in some cases, but actually "immutable" keyword means "not mutable for whole its lifetime"
Re: This is bug or not? (immutable class containing struct with dtor)
On Friday, 17 December 2021 at 17:27:53 UTC, Denis Feklushkin wrote: ~this() {} // Comment out this to fix this compilation error: // Error: `immutable` method `serializer_bug.Imm.~this` is ("serializer_bug" is just name of my local .d file)
This is bug or not? (immutable class containing struct with dtor)
```d /+ dub.json: { "name": "test", "dependencies": { } } +/ struct S { ~this() {} } immutable class Imm { S s; // this is immutable value because whole class is immutable this() { s = S(); } ~this() {} // Comment out this to fix this compilation error: // Error: `immutable` method `serializer_bug.Imm.~this` is not callable using a mutable object // What mutable object is meant here? } void main() { auto ic = new immutable Imm(); } ``` Run: $ dub --single bug.d
Re: Two major problems with dub
On Sunday, 1 August 2021 at 17:18:39 UTC, Alain De Vos wrote: A simple and small wrapper around for instance the C-library Really, dpq2 is that wrapper
Re: Two major problems with dub
On Sunday, 1 August 2021 at 17:37:01 UTC, evilrat wrote: vibe-d - probably because it handles DB connection and/or keep things async way, sure you probably can do it with Phobos but it will be much more PITA and less performant It is because Postgres provides JSON types
Re: Performance issue with fiber
On Monday, 26 July 2021 at 12:09:07 UTC, hanabi1224 wrote: Thank you for your response! I've got some questions tho. On Saturday, 24 July 2021 at 09:17:47 UTC, Stefan Koch wrote: It will not use a fiber pool. Why fiber pool? Isn't fiber a lightweight logical thread which is already implemented with thread pool internally? Spawning fiber is expensive (but not so expensive as spawning thread, of course), but switching is fast. Thus, you can spawn and pause "workers" fibers for avaiting of jobs. (Probably, this behaviour is already implemented in number of libraries and it isn't actually need to implement another one.)
Re: Druntime without pthreads?
On Wednesday, 21 October 2020 at 16:04:20 UTC, Denis Feklushkin wrote: On Tuesday, 20 October 2020 at 16:58:12 UTC, Severin Teona wrote: My curiosity is what would change if I removed from the druntime everything that has to do with mutexes As I remember, your plan is to use some type of RTOS. I am pretty sure what any RTOS provides, at least, mutexes.
Re: Druntime without pthreads?
On Tuesday, 20 October 2020 at 16:58:12 UTC, Severin Teona wrote: My curiosity is what would change if I removed from the druntime everything that has to do with mutexes or threads. Nothing if you don't plan to use multithreading. I temporary disabled threading and appropriate unittests from my fork of druntime without any problem. Would it be possible for the druntime to run and work properly on a microcontroller - where those concepts are not necessary? Sure Could I just remove everything about synchronisation from the druntime, and classes or Garbage Collector to still work properly? Yes
Re: Undefined references in Druntime for microcontrollers
On Monday, 19 October 2020 at 06:25:17 UTC, Severin Teona wrote: Could you help me by telling me what libraries (and how) should I statically compile and link to the druntime? The microcontroller's CPU is an ARM Cortex-M4, and the libraries should be able to be compiled for this architecture. Thank you so much! Most probably they should be provided by your RTOS. At least, FreeRTOS have project for implement Posix thread calls.
Re: question on dub and postgresql
On Monday, 5 October 2020 at 15:08:54 UTC, Alaindevos wrote: On Monday, 5 October 2020 at 14:57:53 UTC, Alaindevos wrote: answer[0][0].as!PGtext contains good data I found an answer. foreach(rownumber; answer.length.iota){ auto arow=answer[rownumber]; writeln(arow); } Yet it would be nice to know why i can't iterate directly over answer using foreach. Use "rangify" template to get forward range from answer
Re: vibe.d / experience / feedback
On Thursday, 1 October 2020 at 06:32:23 UTC, Robert M. Münch wrote: 4. Vide uses an own JSON type, not the standard one. We don't understand why, this just makes things much more complicated and one has to mess around with this. Because standard implementation worse? 5. One can't access the raw HTTP request body, things must be go through Vibe's JSON parser. To get access to the raw body, a lot of workarounds are necessary. Can you create PR?
Re: protobuf-d
On Tuesday, 29 September 2020 at 15:38:43 UTC, Robert Aron wrote: Hello! I am currently working on "D Language Client Libraries for Google APIs" project[0][1]. The first step was to familiarize myself with protobuf and to generate client library for cloud/vision using python plugin with protoc. Today I generated the same library with protobuf-d[2]. When I tried to translate this example[3] from python to D, I noticed that some pieces of code are missing from the D generated library, for example the ImageAnnotatorClient class(or struct) (I could not found it anywhere in the generated code). Here is the command that I used to generate the client library: protoc path/to/cloud/vision/proto/files --proto_path=path/to/common/api/protos --proto-path=. --plugin=path/to/protobuf-d --d_opt=message-as-struct --d_out=path/to/output/files Is that ok? Does it work as it should? Also I read here[4] that the C++ generator defines some default methods. ImageAnnotatorClient isn't described in any of *.proto file in https://github.com/googleapis/googleapis repository. (I found only ImageAnnotator) So, maybe here is messed up proto3 and gRPC or something like it?
Re: I need "windowsx.d" Someone can send It to me?
On Friday, 25 September 2020 at 15:03:56 UTC, Marcone wrote: I need windowsx.d but for I don't know the reason is not in dmd. Someone that have it can send to me? I don't know convert windowsx.h to windowsx.d Maybe it is already available on code.dlang.org?
Re: I need "windowsx.d" Someone can send It to me?
On Saturday, 26 September 2020 at 00:40:21 UTC, Marcone wrote: On Friday, 25 September 2020 at 17:00:04 UTC, Denis Feklushkin wrote: On Friday, 25 September 2020 at 15:03:56 UTC, Marcone wrote: I need windowsx.d but for I don't know the reason is not in dmd. Someone that have it can send to me? I don't know convert windowsx.h to windowsx.d Try to convert C header into D file by dpp tool. When I try dpp in this tutorial: URL? If you have DUB and compiler installed try to run: dub fetch dpp dub build dpp dub run dpp -- --help It works on Linux for me
Re: I need "windowsx.d" Someone can send It to me?
On Friday, 25 September 2020 at 15:03:56 UTC, Marcone wrote: I need windowsx.d but for I don't know the reason is not in dmd. Someone that have it can send to me? I don't know convert windowsx.h to windowsx.d Try to convert C header into D file by dpp tool.
Re: How to implement fastcall ?
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 Time Optimization does by this way.
Re: Building LDC runtime for a microcontroller
Wow, I have just received a link to this topic from my colleague. Here is also another thread about druntime for MCUs: https://forum.dlang.org/post/cwtkntyjhrwvpahfk...@forum.dlang.org
Re: There is Dlang Telegram Bot based on the official Telegram Bot API?
On Friday, 3 April 2020 at 16:10:55 UTC, Baby Beaker wrote: I create Bots for Telegram using Python or PHP. But I love Dlang and would like to create my Bots in Dlang. Is there any support for Dlang to create Telegram Bots? My bots use https://code.dlang.org/packages/telega without any problem
Re: Best way to learn 2d games with D?
On Tuesday, 17 March 2020 at 04:17:41 UTC, Denis Feklushkin wrote: Years ago I wrote this unfinished 2D platformer engine on D: https://github.com/denizzzka/Platformer It ises SFML (graphics and sound), Spine (animation engine) and dchip (2d physics engine) Physics engine used only for ragdoll animation. So, if you want to learn how to programm 2D platformer just look into main loop - It is really simple! https://github.com/denizzzka/Platformer/blob/master/source/app.d#L44
Re: Best way to learn 2d games with D?
On Sunday, 15 March 2020 at 17:58:58 UTC, Steven Schveighoffer wrote: I want to try and learn how to write 2d games. I'd prefer to do it with D. I've found a ton of tutorials on learning 2d gaming with other languages. Is there a place to look that uses D for learning? Should I just start with another language and then migrate to D later? Anyone recommend any specific tutorial/book? -Steve Years ago I wrote this unfinished 2D platformer engine on D: https://github.com/denizzzka/Platformer It ises SFML (graphics and sound), Spine (animation engine) and dchip (2d physics engine)
Re: Porting D to custom OS
On Saturday, 22 February 2020 at 13:20:40 UTC, IGotD- wrote: I'm trying to find information how to port D, especially the D runtime to a proprietary OS. Here is my "Frankenstein" MCU project: https://github.com/denizzzka/d_c_arm_test Maybe this will help you somehow. It is forced to use simultaneously: ldc2, clang, gcc, make, meson. Currently it uses ARM but also I interested in RISC-V. It almost works except druntime. Will there be a future improvement of this so that OS specific support can be moved to separate files and selected on module level instead? Hurrah! I come by search with same idea! I looked into druntime for several days (and never before) and now I think that tree of its source code isn't organized properly and this stucks porting it to architectures very different from well-known Posix. For example, look: https://github.com/dlang/druntime/blob/master/src/core/stdc/errno.d https://github.com/dlang/druntime/blob/master/src/core/stdc/stdio.d Without moving out of architecture-dependent code into separate "subprojects" it is impossible to imagine that this code can be ported without significant labor costs. Also, such a takeaway is necessary because by "architecture" we can mean identical "CPU + OS" bundles but just with different definitions of modern types like int_fast16_t and so on - thousands of "architectures"! This is actual for MCU. Moreover, it would be nice to make as much as possible any parts of this "backend" optional. Let a compilation error happens if there is no some functionality. Then these talks about a certain "minimal druntime", which, in fact, provides abilities what already gives betterC, will stop. Perhaps this proposal isn't new, but the search yielded nothing except your message.
How to use d++ (dpp) with Meson build system?
Hi! Has anyone already have success with this? Is there any kind of idiomatic way?
Re: LDC2 and classic profiling
On Sunday, 12 May 2019 at 17:24:24 UTC, Johan Engelen wrote: Excellent. I think dub -v will output the exact commands that dub is executing. Looks like some parts are not compiled with the compile flag, and some other parts are? Got it! -v displays only one ldc2 execution with -fprofile-instr-generate It contains huge number of -I and -dversion options, and this call contains main.d compilation. But main.d placed inside of subpackage and uses my own (outer) dependency package which also compiled without -fprofile-instr-generate and calls inside of this dependency is not displayed! So, all another ldc2 calls which compiles dependencies is not contain -fprofile-instr-generate! (Also, xray was affected same misconfiguration) Thanks!
Re: LDC2 and classic profiling
On Saturday, 11 May 2019 at 11:38:17 UTC, Denis Feklushkin wrote: Maybe DUB caches binaries and linker links previous non-instrumented object files? I tried "dub clean" and "dub clean-caches" but maybe it is need remove someting else? Checked with "dub -f" and nothing changed.
Re: LDC2 and classic profiling
On Saturday, 11 May 2019 at 09:12:24 UTC, Johan Engelen wrote: Those calls are to templated functions I presume? No instantiated in your program and hence instrumented) Also I changed flags to "dflags-ldc": ["-fprofile-instr-generate", "-O0"] - second flag disables optimisation (I assumed that optimizations magically completely remove calls to my functions. But this is probably not the case.) No, indeed, -O0 doesn't (shouldn't!) matter. Ok. It is strange that you don't see calls to your functions. Just to verify, could you compile a simple program manually (without dub) and verify that you see calls to your own functions? Tried, and it works! Lambdas should also be instrumented, so please test that. Works on simple program too. By the way, if you are on linux, then XRay should work like with clang ( -fxray-instrument ) Tried it, and xray also does not returns any info about my own functions...
Re: LDC2 and classic profiling
On Saturday, 11 May 2019 at 05:46:29 UTC, Denis Feklushkin wrote: All another calls is made inside of this lambda - maybe lambdas is not traced by profiler? Tried to remove lambda with same result. Command: llvm-profdata show -all-functions -topn=10 default.profdata returns huge amount of std*, core*, vibe* calls - it is all used in my code. But here is no one my own function (except "main"). Also I changed flags to "dflags-ldc": ["-fprofile-instr-generate", "-O0"] - second flag disables optimisation (I assumed that optimizations magically completely remove calls to my functions. But this is probably not the case.)
Re: LDC2 and classic profiling
On Friday, 10 May 2019 at 18:09:28 UTC, Johan Engelen wrote: You only need `-fprofile-instr-generate` for generating default.profraw. Yep, it is because I also tried to use uftrace and xray contains only calls to external libraries That's impossible, because those are exactly _not_ profiled. Yes. Probably, it was uftrace output. But, nevertheless, I do not see calls of my own functions. In addition to the call _Dmain and _D4mainQfFAAyaZ9__lambda2MFZv All another calls is made inside of this lambda - maybe lambdas is not traced by profiler? This may help: https://forum.dlang.org/post/voknxddblrbuywcyf...@forum.dlang.org Already read it.
LDC2 and classic profiling
Build with dub some package. Profiling are enabled by dub.json: "dflags-ldc": ["-fprofile-instr-generate", "-finstrument-functions", "-cov"], Resulting default.profraw (and generated default.profdata) contains only calls to external libraries, but not my internal functions calls. Why?
Re: File.lockingBinaryWriter is not output range?
On Tuesday, 19 March 2019 at 13:20:37 UTC, Vladimir Panteleev wrote: On Tuesday, 19 March 2019 at 13:14:52 UTC, Denis Feklushkin wrote: /+ dub.sdl: name "hello_world" +/ This doesn't seem necessary :) I add it ~everywhere for faster reproducing of cases. static assert(isOutputRange!(typeof(stdout.lockingBinaryWriter), byte)); static assert(isOutputRange!(typeof(stdout.lockingBinaryWriter()), byte)); typeof(stdout.lockingBinaryWriter) is a function type. You need the (). Ooops! Thanks! :-) /thread
Re: File.lockingBinaryWriter is not output range?
On Tuesday, 19 March 2019 at 13:14:52 UTC, Denis Feklushkin wrote: stdout.lockingBinaryWriter.put(cast(byte) 123); // works // But this assert is false: static assert(isOutputRange!(typeof(stdout.lockingBinaryWriter), byte)); } Looks like isOutputRange is not checks "put" method properly?
File.lockingBinaryWriter is not output range?
/+ dub.sdl: name "hello_world" +/ import std.algorithm, std.range, std.stdio; void main() { // lockingBinaryWriter: Returns an output range that locks the file and allows fast writing to it. // https://dlang.org/library/std/stdio/file.locking_binary_writer.html stdout.lockingBinaryWriter.put(cast(byte) 123); // works // But this assert is false: static assert(isOutputRange!(typeof(stdout.lockingBinaryWriter), byte)); } This blocks to user File as Stream for msgpack-d.
Re: Returning reference: why this works?
On Wednesday, 13 March 2019 at 21:04:01 UTC, Johan Engelen wrote: On Wednesday, 13 March 2019 at 20:57:13 UTC, Denis Feklushkin wrote: import std.stdio; struct S { int x; } ref S func1(ref S i) // i is reference { return i; } ref S func2(S i) // i is not reference { return func1(i); // Works! Possibility to return reference to local object i? Indeed, you're invoking UB here. With compiler flag `-dip25` that code no longer compiles. -Johan Oh, very unexpected! Thank you very much!
Returning reference: why this works?
import std.stdio; struct S { int x; } ref S func1(ref S i) // i is reference { return i; } ref S func2(S i) // i is not reference { return func1(i); // Works! Possibility to return reference to local object i? //return i; // Error: returning i escapes a reference to parameter i } void main() { auto ret = func2(S(2)); writeln(ret); // "S(2)" }
is(ElementType!(char[2]) == dchar - why?
import std.stdio; import std.range.primitives; void main() { writeln( typeid(ElementType!(char[2])) ); static assert(is(ElementType!(char[2]) == dchar)); // why? } ? https://run.dlang.io/is/Q74yHm
Vibe.d Future.getResult blocks others tasks?
Hi! Simple question to understand logic of quazi-multithreading: Is Future.getResult blocks other tasks for end of "futured" task? Or, another words, task.getResult causes task to ignore `yeilds` inside of this task?
Re: Tools to help me find memory leaks?
On Wednesday, 23 August 2017 at 20:52:17 UTC, Stefan Koch wrote: On Wednesday, 23 August 2017 at 17:30:40 UTC, Drake44 wrote: I'm on a Windows 7 machine and I'm using VisualD as my IDE. I'm trying to work out what's chewing up all the RAM in a program I'm writing... is there a tool that I can use that'll show me what in my program keeps allocating memory? Thanks If you are using the gc then compile with -profile=gc. Which will generate a file that logs all gc allocations. This will not displays number of deallocations. And problem is usually with the fact that something is allocated but not deallocated by GC for some reason. On exiting the program normally. So make sure you can exit via a keypress or after a timelimit has passed. If you are using malloc / calloc / free you'll have to use a tool like valgrind.