On Sunday, 18 May 2025 at 21:40:17 UTC, Damjan wrote:
Hi
I'm experimenting with using D to serve a basic HTML page
(using vibe.d), and while the HTML loads fine, none of my image
files are rendering in the browser — I only see broken icons.
[...]
Your logo.png is not inside the folder "im
On Wednesday, 26 February 2025 at 23:47:41 UTC, Arredondo wrote:
On Wednesday, 26 February 2025 at 10:19:17 UTC, Hipreme wrote:
```d
struct S
{
int[100] a;
int b = 0;
static S defaultInit(int b)
{
S s = void;
s.b = b;
On Wednesday, 26 February 2025 at 03:47:32 UTC, Arredondo wrote:
Is it possible to declare a partially initialized struct?
I would have thought that doing it like this would work:
```
struct S {
int[100] a = void;
int b = 0;
}
```
But when I declare a variable of type `S`, the array `
On Thursday, 25 January 2024 at 15:20:01 UTC, ryuukk_ wrote:
```D
void main()
{
char[32] id = 0;
const(char)* str = "hello";
id = str[0 .. 6];
}
```
it should be a simple memcpy, why DMD complain?
``onlineapp.d(6): Error: mismatched array lengths 32 and 6 for
assignment `id[] =
On Thursday, 14 December 2023 at 12:30:35 UTC, Renato wrote:
Hi, I have been trying D for the last few days... I am only
writing because I really, really like the language! It's
absolutely stunning how the features it has are simple, well
designed and at the same time incredibly advanced! All w
On Wednesday, 8 November 2023 at 11:48:58 UTC, BoQsc wrote:
I would like to export some functionality as external shared
dynamically linked D library.
Is it possible to do that in D Language and what are
limitations?
A simple `writeln` example would be great.
What I expect is an executable
On Saturday, 28 October 2023 at 18:37:37 UTC, Dmitry Ponyatov
wrote:
I want to play with reimplementing some tiny set of standard D
library, mostly for language learning, and need some advice
- is it possible to use `dub` both for building custom druntime
and test app?
- or I must write some bat
On Monday, 9 October 2023 at 18:25:15 UTC, rempas wrote:
On Monday, 9 October 2023 at 17:42:48 UTC, Imperatorn wrote:
You could just add your own int to string I guess?
That will be a good idea! I'll do it in the future if that is
the case, as it's not important, and I want to finish my job.
On Friday, 8 September 2023 at 07:59:37 UTC, rempas wrote:
I do have the following struct:
```d
struct Vec(T) {
private:
T* _ptr = null; // The pointer to the data
u64 _cap = 0; // Total amount of elements (not bytes) we
can store
public:
/* Create a vector by just allocating memory f
On Tuesday, 5 September 2023 at 22:45:28 UTC, raven09 wrote:
Hi,
I've compiled a DLL using D and intended to use it with a C#
winforms app using P/Invoke. Everything works wonderfully as
long as it is called from the main thread (at least I assume
that it not being on the main thread is causin
Hello again!
--
As of some requests in DConf, I'll post here some things related
(or not) to dub recipes.
Since there is so many ways to build D and dub is quite the main
way, I'll try to show other uncommon ways to use it, this is more
recommended to bigger projects since the standard one is
On Wednesday, 5 July 2023 at 22:27:46 UTC, Andrew wrote:
So, I've gotten the itch to have a go at game development in D,
after doing a bit of it in Java last year. I've previously used
LWJGL, which is a java wrapper for OpenGL, OpenAL, GLFW, and
some other useful libs.
The problem is, apparen
On Friday, 14 April 2023 at 20:30:56 UTC, el machine code wrote:
so my question why am i'm getting this error and how do i fix
this?
You need to make those depends on the same version somehow.
From what I've looked. Luna maintains its own fork of
bindbc-imgui. You're probably taking from anoth
On Monday, 3 April 2023 at 09:08:42 UTC, dog2002 wrote:
Hello. The title sounds weird, but I try to explain it better.
In Unreal Engine and Unity, source code files don't use main()
and other important functions. They have only a class. Like
this:
```
class SomeClass: someInterface
{
AFu
On Wednesday, 15 March 2023 at 22:09:35 UTC, WhatMeWorry wrote:
I appreciate all the help people have given me previously. So
I've made everything super simple. The dub.sdl file consists
of four lines:
- Solution to this problem: Checking whether it exists is
completely irrelevant if you do
On Sunday, 12 March 2023 at 15:09:45 UTC, Salih Dincer wrote:
Hi,
As someone who has used const very little in my life, I want to
learn and ask: What are consts used in function parameters for;
isn't there a copy already?
Const is used for you not be able to change your values inside
ref
On Wednesday, 8 March 2023 at 10:49:32 UTC, Markus wrote:
Hi, sorry for the broad and vague question. I have read in some
reddit post about benchmarks, that some code didn't use the
final keyword on methods in a sense that final would make it
faster, I believe.
[...]
Don't bother with it. T
On Monday, 6 March 2023 at 05:59:09 UTC, Mike Parker wrote:
On Monday, 6 March 2023 at 02:09:23 UTC, ryuukk_ wrote:
dub should build a static library for the project i build,
that includes each library it uses that are referenced as
"library" since the default is "staticLibrary" according t
I want to know if there is some way to debug memory leaks in
runtime.
I have been dealing with that by using a profiler and checking D
runtime function calls. Usually those which allocates has high
cpu usage so it can be easy for those bigger ones. While for the
smaller ones, this approach do
On Thursday, 9 February 2023 at 22:34:29 UTC, ProtectAndHide
wrote:
On Thursday, 9 February 2023 at 20:05:06 UTC, Ali Çehreli wrote:
On 2/8/23 04:07, zjh wrote:
> Last time, someone proposed to add `private` like `C++'s`,
We've discussed the 'private' topic very many times already.
C++'s priv
On Monday, 6 February 2023 at 12:22:19 UTC, Matt wrote:
I am (still) writing a 3D graphics engine, and was considering
my choices for a scene graph.
Originally, I was going to use classes derived from my base
SceneNode class for the nodes of the graph, but would this
instead be a better situa
On Saturday, 28 January 2023 at 16:29:35 UTC, Anonymouse wrote:
I use `hasUDA`, `getUDAs` and `getSymbolsByUDA` fairly heavily
in my project. dmd requires some 3.2Gb to compile it, a dub
recompilation taking somewhere around 8-14 seconds, depending
on the phase of the moon. It's not too bad, ad
On Sunday, 22 January 2023 at 17:06:13 UTC, evilrat wrote:
On Sunday, 22 January 2023 at 16:57:56 UTC, Hipreme wrote:
The way to use dub's packages is by using the DFLAGS. With
DFLAGS, I can set the import path to my own DRuntime and own
std. That way I can make the dependencies behave more o
I have been working with WebAssembly for at least 1 entire month
into getting my entire Game Engine and DRuntime ported to it. As
I'm almost reaching the point of the new announcement, I come
here to show how I've done DUB's dependency compatibility with a
custom runtime.
The way to use dub's
On Saturday, 21 January 2023 at 22:53:19 UTC, Matt wrote:
I am trying to write a graphics engine for my university
capstone project, and really wanted to give it a try in D, as
both a talking point, and because I love the language. I'm
using dub to build the library, and the demo application
t
On Friday, 20 January 2023 at 11:28:23 UTC, thebluepandabear
wrote:
Hi,
In Java/C# you can create purely static classes.
These are classes whose methods are all static, the classes
cannot be derived from or instantiated:
```
static class Algo {
void drawLine(Canvas c, Pos from, Pos to) {
On Sunday, 15 January 2023 at 12:44:51 UTC, thebluepandabear
wrote:
Thanks.
How will the variable `outer` become the reference to the
current `X` object (if that makes sense?). Does the compiler do
it automatically?
You'll have to create your struct like `return Y(this)`. It
basically dep
On Thursday, 12 January 2023 at 08:03:34 UTC, John Chapman wrote:
I'm obviously doing something wrong, but don't quite understand.
```d
mixin template helper() {
mixin("writeln(12);");
}
struct Foo {
void opDispatch(string name)() {
import std.stdio;
mixin helper!();
//mixin("wr
So, after some time using D, I found out that `out` isn't used in
so many cases, but when used, it can be quite confusing, because
if you don't read the documentation, it will be unclear that
something is an `out` parameter, specially if you're reading a
code that is not yours. Before using `ou
On Sunday, 4 December 2022 at 09:53:41 UTC, vushu wrote:
Dear dlang community.
I am unsure about what idiomatic D is.
Some of the Dconf talks tells people just to use the GC, until
you can't afford
it.
If there are documents that describes what idiomatic D is then
I would appreciate it.
On Wednesday, 16 November 2022 at 22:51:31 UTC, bioinfornatics
wrote:
Dear community,
I look some day ago to the D wasm page:
-> https://wiki.dlang.org/Generating_WebAssembly_with_LDC
And since then I ask myself can we at compile time convert a D
code to an extern C code for wasm ?
Indeed,
On Tuesday, 22 November 2022 at 21:11:37 UTC, XavierAP wrote:
I was surprised when it didn't compile, though I immediately
found it understandable...
Already read through https://dlang.org/spec/interfaceToC.html
and https://wiki.dlang.org/Bind_D_to_C
[...]
You need to create an alias contain
On Tuesday, 15 November 2022 at 11:42:59 UTC, Alexander Zhirov
wrote:
Is there any way to get the name of class B?
```d
interface A {
string text();
}
class B : A {
override string text() {
return ": It's ok!";
}
}
void main() {
A[] a = cast(A[]) new B[3];
B b = new
Although I really don't like many things about how dub does, it
brings many facilities. Imagine the following project structure:
Project A is using library B
Now, imagine that our `module b` has the following code:
```d
module b;
void print(string s){imported!"std.stdio".writeln(s);}
else ve
Attention, C and C++ programmers are more likely to use what I'm
going to talk about.
If you're a C++ programmer, you're probably thinking about
shared/unique pointers. But that's not what this is about.
Take the `void*` type. This type can be pretty much anything,
this is "okay" if you want
On Tuesday, 8 November 2022 at 12:30:50 UTC, Alexander Zhirov
wrote:
Do I understand correctly that in order for me to pass a string
when creating an object, I must pass it by value? And if I have
a variable containing a string, can I pass it by reference?
Should I always do constructor overlo
On Saturday, 5 November 2022 at 19:19:09 UTC, bauss wrote:
On Saturday, 5 November 2022 at 14:54:52 UTC, Hipreme wrote:
[...]
I have both VS 2019 and 2022, but only 2019 has c++ build tools
etc. I assume that should be fine?
[...]
You forgot to put \link.exe in the path
On Saturday, 5 November 2022 at 14:14:16 UTC, bauss wrote:
On Saturday, 5 November 2022 at 13:42:08 UTC, rikki cattermole
wrote:
Try ldc, if that works then its just a missing library that
needs to be linked against regarding MS CRT.
Using LDC doesn't seem to work either, it has similar linkin
On Saturday, 5 November 2022 at 01:34:04 UTC, ryuukk_ wrote:
On Friday, 4 November 2022 at 10:57:12 UTC, Hipreme wrote:
Package.d is a real problem existing on our currently modules
design. First is that it means to take the directory name to
use as a module.
This is a problem for 3 reasons:
On Friday, 4 November 2022 at 16:21:17 UTC, z wrote:
On Friday, 4 November 2022 at 10:57:12 UTC, Hipreme wrote:
...
What do we use instead?
I won't lie about the fact package.d forced me to workaround
elusive "bugs" in my usage(1) but what is the alternative if we
don't want to work around i
On Friday, 4 November 2022 at 14:11:55 UTC, bauss wrote:
On Friday, 4 November 2022 at 10:57:12 UTC, Hipreme wrote:
...
I disagree completely with being against package.d.
Having used D for like a decade at this point, I've never
experienced any issues with it.
Most issues seems to be for
Package.d is a real problem existing on our currently modules
design. First is that it means to take the directory name to use
as a module.
This is a problem for 3 reasons:
1. You won't be able to find your module by the file name. This
is incredibly common, for instance, in Visual Studio Cod
The linker used on Windows when installing DMD is pretty much
decided on how your PC was setup.
- If you had Visual Studio installed on your windows for "Desktop
Development with C++" before downloading DMD (from the site and
setup), you will pretty have MSVC Linker as a default.
- If you inst
On Wednesday, 26 October 2022 at 22:51:53 UTC, DLearner wrote:
On Wednesday, 26 October 2022 at 18:53:58 UTC, Hipreme wrote:
On Wednesday, 26 October 2022 at 18:37:00 UTC, DLearner wrote:
On Wednesday, 26 October 2022 at 16:58:08 UTC, H. S. Teoh
wrote:
On Wed, Oct 26, 2022 at 04:20:01PM +,
On Wednesday, 26 October 2022 at 18:37:00 UTC, DLearner wrote:
On Wednesday, 26 October 2022 at 16:58:08 UTC, H. S. Teoh wrote:
On Wed, Oct 26, 2022 at 04:20:01PM +, DLearner via
Digitalmars-d-learn wrote:
Hi
Never used DUB before.
Wanted to use a function stored in a module outside the ma
On Tuesday, 25 October 2022 at 12:29:50 UTC, Andrey Zherikov
wrote:
On Sunday, 23 October 2022 at 20:12:46 UTC, Hipreme wrote:
This will greatly reduce the number of import and dependencies
you need if you ever need to distribute a library.
Could you elaborate more on the benefit? Does it redu
For reducing a D Interface file dependency when generating it
with the `-H` flag for DMD, you can't import a module on the top
level.
Take a look at that example:
```d
module a;
import std.stdio;
void printSomething(string a)
{
writeln(a);
}
```
If you generate the .di interface file while u
On Friday, 21 October 2022 at 18:10:39 UTC, ryuukk_ wrote:
I tried your project:
Linux x64
```
git clone https://github.com/MrcSnm/HipremeEngine.git
cd HipremeEngine
dub build (once to download dependencies if any)
time dub build -f
real0m4.604s
user0m3.686s
sys 0m0.900s
```
4.6
Hey guys, I have been complaining a lot of time right now from D
compilation speed at least for my project.
I have:
- Underused CTFE
- Underused Templates
- Avoided importing standard libraries
- Created a multi module projects for better code reuse
Those are all the techniques I have tried to
Hey guys, I'm going to start making a tip of the day (although
I'm pretty sure I won't be able to give every day a tip), but
those things are really interesting to newcomers to know and may
be obvious to some of the old schoolers there.
Always public import a type that the user (including you)
On Tuesday, 18 October 2022 at 19:38:39 UTC, Ali Çehreli wrote:
On 10/18/22 12:26, Hipreme wrote:
> Is there any way to know which files produced this error or
at least the
> symbol names that are clashing? I'm totally helpless about
this error.
There is 'nm' on Posix systems that lists symbols
I get the warning `warning LNK4255: library contain multiple
objects of the same name; linking object as if no debug info`
when dealing a project with multiple static libraries.
Is there any way to know which files produced this error or at
least the symbol names that are clashing? I'm totally
On Sunday, 31 July 2022 at 19:25:51 UTC, Hipreme wrote:
I wish to generate some functions using mixin template and I
wish to check if the current class already has an specific
overload with parameters (A, B).
What I'm currently trying is doing `__traits(getOverloads, T,
"foo")`, and then chec
I wish to generate some functions using mixin template and I wish
to check if the current class already has an specific overload
with parameters (A, B).
What I'm currently trying is doing `__traits(getOverloads, T,
"foo")`, and then checking if its type are equal. But it seems
hackish, and I
So, I've came to a situation where I must use mixin template for
defining members overloads, like:
```d
mixin template OverloadGen()
{
static if(hasMethod!(typeof(this), "add", int, int))
{
float add(float x, float y){return x+y;}
}
static if(hasMethod!(typeof(this), "mul"
On Tuesday, 12 July 2022 at 16:40:38 UTC, H. S. Teoh wrote:
On Tue, Jul 12, 2022 at 04:27:44PM +, Antonio via
Digitalmars-d-learn wrote:
It works
```d
void main()
{
assert(null=="");
}
```
why?
Because an empty string is, by default, represented by an empty
slice of the null pointer.
I'm stuck in a racing condition right now and I'm unable to run a
debugger on the code. Usually I was using Visual Studio 2019 for
debugging my code, but it shows the following message:
"Your app has entered a break state, but there is no code to show
because all threads were executing externa
On Sunday, 16 January 2022 at 20:01:09 UTC, JN wrote:
On Saturday, 15 January 2022 at 23:15:16 UTC, JN wrote:
Is there some way I could improve this with some D features?
My main gripes with it are:
Managed to dramatically simplify it to 10 lines of code with
variadic templates.
```d
im
On Wednesday, 19 January 2022 at 02:31:31 UTC, Hipreme wrote:
I have separated my project in a bunch of modules to be
compiled separated. But it seems I have lost my debugging power
since then. I would like to know if there is any workaround
beside not using it as a lib.
I'm using it from dub
On Sunday, 16 January 2022 at 18:03:53 UTC, Paul Backus wrote:
On Sunday, 16 January 2022 at 15:15:07 UTC, Hipreme wrote:
Is there some way to throw a stack trace when killing the
program from the CTRL+C from the terminal?
It would help a lot into debugging occasional infinity loops
On POSIX
On Wednesday, 19 January 2022 at 08:47:27 UTC, Enjoys Math wrote:
```
module expr;
import dots;
import operator;
import equation;
import var;
import var_expr;
import zz_const;
class Expr
{
public:
void opBinary(string op)(string s) const
{
static if (op == "+")
{
Expr
I have separated my project in a bunch of modules to be compiled
separated. But it seems I have lost my debugging power since
then. I would like to know if there is any workaround beside not
using it as a lib.
I'm using it from dub and it is has the debug options on them:
```
"buildOptions": [
Is there some way to throw a stack trace when killing the program
from the CTRL+C from the terminal?
It would help a lot into debugging occasional infinity loops
Okay, I do agree with you that I may have exaggerated with
absolute intuitiveness, but I was talking about that
intuitiveness for loading a symbol from a shared library.
You're limited to using C's types
- I think I don't understood what you meant with that, if the
data type is known before h
I write this post as both a learning tool, a question and an
inquiry.
There are just a lot of drawbacks in trying to do function
exporting while using D.
That interface is absurdly confuse and that is probably why I've
never seen a project here which made an use of extern(D) while
using a D
On Thursday, 30 September 2021 at 03:21:51 UTC, jfondren wrote:
On Thursday, 30 September 2021 at 03:13:28 UTC, jfondren wrote:
As provided, loadSymbol without the "static if":
965K libhipengine_api.a
with `mixin(loadSymbol("name"))` instead of a template:
749K libhipengine_api.a
The differ
On Thursday, 30 September 2021 at 02:22:35 UTC, jfondren wrote:
On Thursday, 30 September 2021 at 01:44:57 UTC, jfondren wrote:
On Thursday, 30 September 2021 at 01:09:47 UTC, Hipreme wrote:
I have a template function that all it does is given a
symbol, it loads a dll for its type + its name:
On Thursday, 30 September 2021 at 01:09:47 UTC, Hipreme wrote:
I have a template function that all it does is given a symbol,
it loads a dll for its type + its name:
```
void loadSymbol(alias s, string symName = "")()
{
static if(symName == "")
s = cast(typeof(s))_loadSy
On Thursday, 30 September 2021 at 01:56:42 UTC, Basile B. wrote:
On Thursday, 30 September 2021 at 01:09:47 UTC, Hipreme wrote:
I have a template function that all it does is given a symbol,
it loads a dll for its type + its name:
```
void loadSymbol(alias s, string symName = "")()
{
s
I have a template function that all it does is given a symbol, it
loads a dll for its type + its name:
```
void loadSymbol(alias s, string symName = "")()
{
static if(symName == "")
s = cast(typeof(s))_loadSymbol(_dll, (s.stringof~"\0").ptr);
else
I have a plenty of questions related to the DLL things, .di files.
Basically: I have a main program which would contain a lot of
code. I have a secondary program which I want to call code from
the main program, but it will be compiled as a DLL to the main
program call a single entry point from
71 matches
Mail list logo