Re: Why is my image not rendering in a simple HTML page served with D?

2025-05-18 Thread Hipreme via Digitalmars-d-learn
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

Re: Partially initialized structs?

2025-02-26 Thread Hipreme via Digitalmars-d-learn
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;

Re: Partially initialized structs?

2025-02-26 Thread Hipreme via Digitalmars-d-learn
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 `

Re: Why is the following failing?

2024-01-25 Thread Hipreme via Digitalmars-d-learn
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[] =

Re: D is a great language, but I've had a bad experience getting started

2023-12-14 Thread Hipreme via Digitalmars-d-learn
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

Re: D: How would one make a shared dynamically linked D library?

2023-11-08 Thread Hipreme via Digitalmars-d-learn
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

Re: druntime homebrew: setup and compile a single project with its own stdlib

2023-10-28 Thread Hipreme via Digitalmars-d-learn
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

Re: How to use ".stringof" to get the value of a variable and not the name of the variable (identifier) itself?

2023-10-10 Thread Hipreme via Digitalmars-d-learn
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.

Re: malloc error when trying to assign the returned pointer to a struct field

2023-09-08 Thread Hipreme via Digitalmars-d-learn
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

Re: D DLL crashes if not run on the main thread

2023-09-05 Thread Hipreme via Digitalmars-d-learn
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

Hipreme's Tip of of the day #09 - Using D shared libraries with dub

2023-09-04 Thread Hipreme via Digitalmars-d-learn
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

Re: Options for Cross-Platform 3D Game Development

2023-07-06 Thread Hipreme via Digitalmars-d-learn
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

Re: Unresolvable dependencies to package

2023-04-14 Thread Hipreme via Digitalmars-d-learn
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

Re: Is it possible to make a library (dll/so) from separated .d files?

2023-04-03 Thread Hipreme via Digitalmars-d-learn
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

Re: My tiny program still can't get FreeImage.dll to load... GLFW.dll library loads no problem...

2023-03-15 Thread Hipreme via Digitalmars-d-learn
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

Re: const in functions

2023-03-12 Thread Hipreme via Digitalmars-d-learn
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

Re: Can nice D code get a bit slow?

2023-03-08 Thread Hipreme via Digitalmars-d-learn
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

Re: How to build a static lib properly?

2023-03-08 Thread Hipreme via Digitalmars-d-learn
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

Debugging memory leaks

2023-02-15 Thread Hipreme via Digitalmars-d-learn
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

Re: Non-ugly ways to implement a 'static' class or namespace?

2023-02-09 Thread Hipreme via Digitalmars-d-learn
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

Re: A potential use-case for template mixins?

2023-02-06 Thread Hipreme via Digitalmars-d-learn
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

Re: hasUDA alternatives?

2023-01-28 Thread Hipreme via Digitalmars-d-learn
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

Re: Hipreme's #8 Tip of the day - Using custom runtime with dub projects

2023-01-22 Thread Hipreme via Digitalmars-d-learn
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

Hipreme's #8 Tip of the day - Using custom runtime with dub projects

2023-01-22 Thread Hipreme via Digitalmars-d-learn
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

Re: How to write a library

2023-01-21 Thread Hipreme via Digitalmars-d-learn
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

Re: Non-ugly ways to implement a 'static' class or namespace?

2023-01-20 Thread Hipreme via Digitalmars-d-learn
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) {

Re: How to access private variable of outer class from an inner struct

2023-01-15 Thread Hipreme via Digitalmars-d-learn
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

Re: Mixin helper help

2023-01-12 Thread Hipreme via Digitalmars-d-learn
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

Hipreme's #7 Tip of the day - Using the out parameters

2022-12-31 Thread Hipreme via Digitalmars-d-learn
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

Re: Idiomatic D using GC as a library writer

2022-12-04 Thread Hipreme via Digitalmars-d-learn
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.

Re: Can we ease WASM in D ?

2022-11-23 Thread Hipreme via Digitalmars-d-learn
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,

Re: Can't assign extern(C) function pointer to D variable?

2022-11-22 Thread Hipreme via Digitalmars-d-learn
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

Re: Get the class name without casting the type

2022-11-15 Thread Hipreme via Digitalmars-d-learn
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

Hipreme's #6 Tip of the day - Knowing when and how to use dub's Have_version

2022-11-13 Thread Hipreme via Digitalmars-d-learn
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

Hipreme's #5 Tip of the day - Avoid raw pointers at all cost

2022-11-11 Thread Hipreme via Digitalmars-d-learn
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

Re: Passing a string by reference

2022-11-08 Thread Hipreme via Digitalmars-d-learn
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

Re: Linking not working properly Windows 11

2022-11-05 Thread Hipreme via Digitalmars-d-learn
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

Re: Linking not working properly Windows 11

2022-11-05 Thread Hipreme via Digitalmars-d-learn
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

Re: Hipreme's #4 Tip of the day - Don't use package.d

2022-11-05 Thread Hipreme via Digitalmars-d-learn
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:

Re: Hipreme's #4 Tip of the day - Don't use package.d

2022-11-04 Thread Hipreme via Digitalmars-d-learn
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

Re: Hipreme's #4 Tip of the day - Don't use package.d

2022-11-04 Thread Hipreme via Digitalmars-d-learn
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

Hipreme's #4 Tip of the day - Don't use package.d

2022-11-04 Thread Hipreme via Digitalmars-d-learn
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

Hipreme's #3 Tip of the day - Changing DMD linker on Windows

2022-11-01 Thread Hipreme via Digitalmars-d-learn
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

Re: Importing modules under DUB on Windows

2022-10-26 Thread Hipreme via Digitalmars-d-learn
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 +,

Re: Importing modules under DUB on Windows

2022-10-26 Thread Hipreme via Digitalmars-d-learn
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

Re: Hipreme's #2 Tip of the day - Reducing .di files dependency

2022-10-26 Thread Hipreme via Digitalmars-d-learn
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

Hipreme's #2 Tip of the day - Reducing .di files dependency

2022-10-23 Thread Hipreme via Digitalmars-d-learn
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

Re: [Help Needed] - Debugging compilation time

2022-10-22 Thread Hipreme via Digitalmars-d-learn
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

[Help Needed] - Debugging compilation time

2022-10-21 Thread Hipreme via Digitalmars-d-learn
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

Hipreme's #1 Tip of the day

2022-10-19 Thread Hipreme via Digitalmars-d-learn
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)

Re: warning LNK4255 - How to solve this warning

2022-10-18 Thread Hipreme via Digitalmars-d-learn
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

warning LNK4255 - How to solve this warning

2022-10-18 Thread Hipreme via Digitalmars-d-learn
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

Re: How to check if a class has a specific overload for member x?

2022-07-31 Thread Hipreme via Digitalmars-d-learn
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

How to check if a class has a specific overload for member x?

2022-07-31 Thread Hipreme via Digitalmars-d-learn
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

Iterating over mixin template members

2022-07-28 Thread Hipreme via Digitalmars-d-learn
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"

Re: null == "" is true?

2022-07-12 Thread Hipreme via Digitalmars-d-learn
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.

How to debug thread code

2022-07-10 Thread Hipreme via Digitalmars-d-learn
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

Re: Improve a simple event handler

2022-01-19 Thread Hipreme via Digitalmars-d-learn
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

Re: Debug symbols from libs not being linked on windows

2022-01-19 Thread Hipreme via Digitalmars-d-learn
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

Re: Throw stack trace from program kill

2022-01-19 Thread Hipreme via Digitalmars-d-learn
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

Re: Function prototype overloading does not work ?

2022-01-19 Thread Hipreme via Digitalmars-d-learn
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

Debug symbols from libs not being linked on windows

2022-01-18 Thread Hipreme via Digitalmars-d-learn
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": [

Throw stack trace from program kill

2022-01-16 Thread Hipreme via Digitalmars-d-learn
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

Re: Dynamically binding to D code using extern(D)

2021-09-30 Thread Hipreme via Digitalmars-d-learn
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

Dynamically binding to D code using extern(D)

2021-09-30 Thread Hipreme via Digitalmars-d-learn
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

Re: 0 cost template instantiation

2021-09-29 Thread Hipreme via Digitalmars-d-learn
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

Re: 0 cost template instantiation

2021-09-29 Thread Hipreme via Digitalmars-d-learn
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:

Re: 0 cost template instantiation

2021-09-29 Thread Hipreme via Digitalmars-d-learn
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

Re: 0 cost template instantiation

2021-09-29 Thread Hipreme via Digitalmars-d-learn
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

0 cost template instantiation

2021-09-29 Thread Hipreme via Digitalmars-d-learn
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

D's dll and classes

2021-09-19 Thread Hipreme via Digitalmars-d-learn
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