Re: Passing pointer to extern(C++) templated function

2020-10-13 Thread kinke via Digitalmars-d-learn
On Wednesday, 14 October 2020 at 00:25:56 UTC, Jamie wrote: Happy to file a bug, but if it was a bug in the mangler wouldn't both C++ and D get the same result? Assuming D uses the same mangler for the extern(C++) stuff. Bug in the D frontend implementation of Itanium C++ mangling. https://gi

Re: How do I make this function from module public?

2020-10-13 Thread Adam D. Ruppe via Digitalmars-d-learn
On Wednesday, 14 October 2020 at 01:46:11 UTC, Jack wrote: extern(C): int mul(int a, int b) { return a * b;} mark it `export` as well and then be sure you are compiling in this module as well, it must be included on the ldc command line along with wasm.d

Re: How do I make this function from module public?

2020-10-13 Thread Jack via Digitalmars-d-learn
I'm compiling with ldc2 -mtriple=wasm32-unknow-unknow-wasm -betterC wasm.d

How do I make this function from module public?

2020-10-13 Thread Jack via Digitalmars-d-learn
I'm playing with wasm, I wrote a small module where I'd like to make the function available but wasm can't find this function. math.d module math; extern(C): int mul(int a, int b) { return a * b;} wasm.d public import math; extern(C): // disable D mangling void doSomething() { ... } // s

Re: Error on dub build - Trying Vibe-d for the first time

2020-10-13 Thread Steven Schveighoffer via Digitalmars-d-learn
On 10/13/20 8:40 PM, Bruno Rodrigues wrote: So, I tried building a simple hello world with Vibe-d and got this error /usr/bin/ld: cannot find -lssl /usr/bin/ld: cannot find -lcrypto collect2: error: ld returned 1 exit status Error: linker exited with status 1 /usr/bin/dmd failed with exit code

Error on dub build - Trying Vibe-d for the first time

2020-10-13 Thread Bruno Rodrigues via Digitalmars-d-learn
So, I tried building a simple hello world with Vibe-d and got this error /usr/bin/ld: cannot find -lssl /usr/bin/ld: cannot find -lcrypto collect2: error: ld returned 1 exit status Error: linker exited with status 1 /usr/bin/dmd failed with exit code 1. I have absolutely no ideia what these l

Re: Passing pointer to extern(C++) templated function

2020-10-13 Thread Jamie via Digitalmars-d-learn
On Tuesday, 13 October 2020 at 23:39:38 UTC, Ali Çehreli wrote: On 10/13/20 4:11 PM, James Blachly wrote: On 10/13/20 5:23 AM, Jamie wrote: I think the issue is with D's "turtles all the way down" style const. My workaround would be to define wrapper functions that may need to do casting on

Re: Passing pointer to extern(C++) templated function

2020-10-13 Thread Jamie via Digitalmars-d-learn
On Tuesday, 13 October 2020 at 23:47:24 UTC, kinke wrote: On Tuesday, 13 October 2020 at 09:23:48 UTC, Jamie wrote: It appears that func3 and func4 take on different types depending on other variables being present? Is this expected? Nope, it's a bug in the Itanium C++ mangler, please file a b

Re: Win32api: How to send a Struct in DialogBox?

2020-10-13 Thread starcanopy via Digitalmars-d-learn
On Wednesday, 14 October 2020 at 00:07:10 UTC, Marcone wrote: Solved: Teste * params = cast(Teste*) lParam; writeln(params.nome); writeln(params.idade); But here, how can send struct? DialogBoxParam(null, MAKEINTRESOURCE(IDD_DIALOG1), null, &DlgMain, cast(int) &test); // Error, need "int" b

Re: Win32api: How to send a Struct in DialogBox?

2020-10-13 Thread Marcone via Digitalmars-d-learn
Solved: Teste * params = cast(Teste*) lParam; writeln(params.nome); writeln(params.idade); But here, how can send struct? DialogBoxParam(null, MAKEINTRESOURCE(IDD_DIALOG1), null, &DlgMain, cast(int) &test); // Error, need "int" but I am sending Test*

Re: Win32api: How to send a Struct in DialogBox?

2020-10-13 Thread Marcone via Digitalmars-d-learn
DialogBoxParam receive need "int". How convert struct object reference to int and cast to struct type after? I will cast using: Teste * params = cast(Teste*) LOWORD(lParam); writeln(params.nome); writeln(params.idade); But here, how can send struct? DialogBoxParam(null, MAKEINTRESOURCE(IDD_

Re: Passing pointer to extern(C++) templated function

2020-10-13 Thread kinke via Digitalmars-d-learn
On Tuesday, 13 October 2020 at 09:23:48 UTC, Jamie wrote: It appears that func3 and func4 take on different types depending on other variables being present? Is this expected? Nope, it's a bug in the Itanium C++ mangler, please file a bug. MSVC++ mangling seems fine, after fixing the D declara

Re: Passing pointer to extern(C++) templated function

2020-10-13 Thread Ali Çehreli via Digitalmars-d-learn
On 10/13/20 4:11 PM, James Blachly wrote: On 10/13/20 5:23 AM, Jamie wrote: Building with: g++ -c a.cpp dmd main.d a.o Throws the error: /usr/bin/ld: main.o: in function `_Dmain': main.d:(.text._Dmain[_Dmain]+0x31): undefined reference to `void func3(int*, int*)' /usr/bin/ld: main.d:(.text._Dm

Re: Passing pointer to extern(C++) templated function

2020-10-13 Thread James Blachly via Digitalmars-d-learn
On 10/13/20 5:23 AM, Jamie wrote: Building with: g++ -c a.cpp dmd main.d a.o Throws the error: /usr/bin/ld: main.o: in function `_Dmain': main.d:(.text._Dmain[_Dmain]+0x31): undefined reference to `void func3(int*, int*)' /usr/bin/ld: main.d:(.text._Dmain[_Dmain]+0x3e): undefined reference to

Re: Win32api: How to send a Struct in DialogBox?

2020-10-13 Thread Marcone via Digitalmars-d-learn
On Tuesday, 13 October 2020 at 22:46:36 UTC, starcanopy wrote: On Tuesday, 13 October 2020 at 22:26:35 UTC, Marcone wrote: [...] Instead of calling DialogBox, you might try DialogBoxParam[A|W]. [...] - https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-dialogboxparamw

Re: Win32api: How to send a Struct in DialogBox?

2020-10-13 Thread starcanopy via Digitalmars-d-learn
On Tuesday, 13 October 2020 at 22:26:35 UTC, Marcone wrote: struct Teste { string nome = "Paul"; int idade = 33; } extern(Windows): BOOL DlgMain(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) nothrow { // I want to be able to use the struct object here. // writeln(test.

Win32api: How to send a Struct in DialogBox?

2020-10-13 Thread Marcone via Digitalmars-d-learn
struct Teste { string nome = "Paul"; int idade = 33; } extern(Windows): BOOL DlgMain(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) nothrow { // I want to be able to use the struct object here. // writeln(test.nome); return false; } void chamaJanela(){ Test test

Re: vibe.d / experience / feedback

2020-10-13 Thread Andre Pany via Digitalmars-d-learn
On Tuesday, 13 October 2020 at 17:08:04 UTC, Robert M. Münch wrote: On 13 Oct 2020 at 09:57:14 CEST, "aberba" wrote: D is a great language that is capable of solving any problem easier than what it'll take to do in equivalent languages. Don't get me wrong, D is great, it has a lot of techni

Re: vibe.d / experience / feedback

2020-10-13 Thread Robert M . Münch via Digitalmars-d-learn
On 13 Oct 2020 at 09:57:14 CEST, "aberba" wrote: > D is a great language that is capable of solving any problem > easier than what it'll take to do in equivalent languages. Don't get me wrong, D is great, it has a lot of technically cool things on board. As said, those technical things won't b

Re: How do I use translation module in vibe.d?

2020-10-13 Thread Jack via Digitalmars-d-learn
On Tuesday, 13 October 2020 at 08:08:54 UTC, aberba wrote: On Friday, 9 October 2020 at 21:07:28 UTC, jack wrote: Documentation[1] tells to use @translationModule!TranslationContext on class, like this: @translationModule!TranslationContext class WebInterface { ... but it return the error:

Re: How do I use translation module in vibe.d?

2020-10-13 Thread Jack via Digitalmars-d-learn
On Tuesday, 13 October 2020 at 08:07:17 UTC, aberba wrote: On Friday, 9 October 2020 at 21:07:28 UTC, jack wrote: Documentation[1] tells to use @translationModule!TranslationContext on class, like this: @translationModule!TranslationContext class WebInterface { ... but it return the error:

Re: How do I use translation module in vibe.d?

2020-10-13 Thread Jack via Digitalmars-d-learn
On Tuesday, 13 October 2020 at 08:03:26 UTC, aberba wrote: On Friday, 9 October 2020 at 21:07:28 UTC, jack wrote: [...] Did you do this? [...] Yes, I did exacly that.

Re: vibe.d / experience / feedback

2020-10-13 Thread Alain De Vos via Digitalmars-d-learn
I find the code with @ ugly. But i know this is not a good argument. Maybe the glue could have been done better. I think there is a lot of functionality but I don't understand it by looking at the code which you easily can with flask or rails.

Re: vibe.d / experience / feedback

2020-10-13 Thread Robert M . Münch via Digitalmars-d-learn
On 12 Oct 2020 at 21:58:12 CEST, "Ola Fosheim Grøstad" wrote: > On Monday, 12 October 2020 at 11:06:55 UTC, Robert M. Münch wrote: >> Go seems to be kept as simple as possible, even if you have to >> write more code. Which is, in the long run, the cheaper and >> smaller burden. No tricks, no

Re: vibe.d / experience / feedback

2020-10-13 Thread aberba via Digitalmars-d-learn
On Tuesday, 13 October 2020 at 15:02:08 UTC, Alaindevos wrote: What is weird is that rails is THE ruby application , that flask is the python application, and that dlang can't have something like that in their standard library. An opportunity missed. On the other hand I don't understand the int

Re: vibe.d / experience / feedback

2020-10-13 Thread Alaindevos via Digitalmars-d-learn
What is weird is that rails is THE ruby application , that flask is the python application, and that dlang can't have something like that in their standard library. An opportunity missed. On the other hand I don't understand the interest in Java/swing when there is a good working gtkd which is

Re: How to specify which parameters a function that is received as an argument should receive?

2020-10-13 Thread Mitacha via Digitalmars-d-learn
On Tuesday, 13 October 2020 at 09:02:04 UTC, Marcone wrote: How to specify which parameters a function that is received as an argument should receive? Example: import std; void myfun(int n){ writeln(n); } void test(lazy void delegate() fun) // how specify that "fun" may receive int ?

Passing pointer to extern(C++) templated function

2020-10-13 Thread Jamie via Digitalmars-d-learn
I'm having difficulties linking templated functions with multiple pointer arguments with extern(C++). a.cpp - template void func1(T *b){} template void func1(int *b); template void func2(const T *a){} template void func2(const int *a); template void func3(T *b, const T *a){} template void

How to specify which parameters a function that is received as an argument should receive?

2020-10-13 Thread Marcone via Digitalmars-d-learn
How to specify which parameters a function that is received as an argument should receive? Example: import std; void myfun(int n){ writeln(n); } void test(lazy void delegate() fun) // how specify that "fun" may receive int ? { fun(int); } test({myfun;});

Re: How to add an additional config dir in DUB under source?

2020-10-13 Thread tastyminerals via Digitalmars-d-learn
On Tuesday, 13 October 2020 at 05:13:18 UTC, Mike Parker wrote: On Monday, 12 October 2020 at 22:31:53 UTC, tastyminerals wrote: [...] This: readText("conf.toml"); [...] Thanks. I remembered that I read about them in Ali's book but never actually used them.

Re: How do I use translation module in vibe.d?

2020-10-13 Thread aberba via Digitalmars-d-learn
On Friday, 9 October 2020 at 21:07:28 UTC, jack wrote: Documentation[1] tells to use @translationModule!TranslationContext on class, like this: @translationModule!TranslationContext class WebInterface { ... but it return the error: Error: template instance translationModule!(TranslationCon

Re: How do I use translation module in vibe.d?

2020-10-13 Thread aberba via Digitalmars-d-learn
On Friday, 9 October 2020 at 21:07:28 UTC, jack wrote: Documentation[1] tells to use @translationModule!TranslationContext on class, like this: @translationModule!TranslationContext class WebInterface { ... but it return the error: Error: template instance translationModule!(TranslationCon

Re: How do I use translation module in vibe.d?

2020-10-13 Thread aberba via Digitalmars-d-learn
On Friday, 9 October 2020 at 21:07:28 UTC, jack wrote: Documentation[1] tells to use @translationModule!TranslationContext on class, like this: [...] but it return the error: [...] it seems that construtor was removed[2] but I can't find the replacement anywhere. Could someone help wit

Re: vibe.d / experience / feedback

2020-10-13 Thread aberba via Digitalmars-d-learn
On Saturday, 3 October 2020 at 11:31:27 UTC, Robert M. Münch wrote: On 3 Oct 2020 at 13:14:57 CEST, "0xEAB" wrote: On Saturday, 3 October 2020 at 07:54:58 UTC, Martin wrote: On Friday, 2 October 2020 at 09:46:09 UTC, Denis Feklushkin wrote: Because standard implementation worse? What

Re: vibe.d / experience / feedback

2020-10-13 Thread aberba via Digitalmars-d-learn
On Monday, 12 October 2020 at 11:06:55 UTC, Robert M. Münch wrote: On 11 Oct 2020 at 16:46:13 CEST, "Ola Fosheim Grøstad" wrote: Ada, Java, Eiffel are supposed to. Yes... beside Java, the other two are already in the exotic department... I'm not sure if Go is a success in that department