Re: LNK2019 error in the C++ interface

2021-06-10 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 10 June 2021 at 13:19:34 UTC, dokutoku wrote: I still haven't solved this problem. Not sure if this is the issue, but you don't need `extern` on these. You already have the `extern(C++)` thing at the top of the file. ```d extern void str_test(LPCSTR str1); not

Re: LNK2019 error in the C++ interface

2021-06-10 Thread dokutoku via Digitalmars-d-learn
It's been a while since then, but the problem with the structure has been solved. The reason seems to be that the structure name defined in core.sys.windows.windef was not tagRECT. I was able to get it to compile by adding a custom definition as follows ```d extern (C) struct tagRECT {

Re: how do i fix this node_dlang error?

2021-06-08 Thread Jack via Digitalmars-d-learn
your system. So if there’s a mismatch between the embedded version and the one you linked against, you can see the error you’re seeing. I know I took way too much of your time... but could you give just some overalls directions on how to make fix that? can I set that dll which gets embeded in ele

Re: how do i fix this node_dlang error?

2021-06-08 Thread Jack via Digitalmars-d-learn
embedded version and the one you linked against, you can see the error you’re seeing. I don't use Windows often, my bad for incompatibilities there. I updated Electron, node and DMD. After running console.log (process.versions) in Electron I get: { node: '14.16.0&

Re: how do i fix this node_dlang error?

2021-06-07 Thread NotSpooky via Digitalmars-d-learn
your system. So if there’s a mismatch between the embedded version and the one you linked against, you can see the error you’re seeing. I don't use Windows often, my bad for incompatibilities there. I updated Electron, node and DMD. After running console.log (process.versions) in Elec

Re: how do i fix this node_dlang error?

2021-06-07 Thread Mike Parker via Digitalmars-d-learn
n and the one you linked against, you can see the error you’re seeing.

Re: how do i fix this node_dlang error?

2021-06-07 Thread Jack via Digitalmars-d-learn
matter. i see Your problem may be unrelated to D, though. It appears to be a common error when developing native code for Electron. Googling for "electron {paste error message here}" or for "electron dll initialization" turns up several results. I'm googling this has

Re: how do i fix this node_dlang error?

2021-06-07 Thread Mike Parker via Digitalmars-d-learn
appears to be a common error when developing native code for Electron. Googling for "electron {paste error message here}" or for "electron dll initialization" turns up several results. Some cursory reading shows that the issue may be a version mismatch between the version of nod

Re: how do i fix this node_dlang error?

2021-06-07 Thread Jack via Digitalmars-d-learn
On Monday, 7 June 2021 at 20:37:19 UTC, MoonlightSentinel wrote: On Monday, 7 June 2021 at 19:03:44 UTC, Jack wrote: actually i didnt so I just added: ```d shared static this() { Runtime.initialize(); } shared static ~this() { Runtime.terminate(); } ``` but it didn't change an

Re: how do i fix this node_dlang error?

2021-06-07 Thread Jack via Digitalmars-d-learn
On Monday, 7 June 2021 at 20:13:03 UTC, frame wrote: On Monday, 7 June 2021 at 02:33:38 UTC, Jack wrote: What am I missing? If this runs under Windows, there is no dlopen(), maybe a wrapper to LoadLibrary() but this will need to call a DllMain() in the DLL if I am not wrong. Is there a DllM

Re: how do i fix this node_dlang error?

2021-06-07 Thread Jack via Digitalmars-d-learn
DllMain? I just noticied that's supposed to have a DllMain even tho the [code example](https://github.com/NotSpooky/node_dlang/blob/master/examples/type_examples/source/example.d) from node_dlang doesn't have one and it was working(?) I added one in my code but it give same error. I added

Re: how do i fix this node_dlang error?

2021-06-07 Thread MoonlightSentinel via Digitalmars-d-learn
On Monday, 7 June 2021 at 19:03:44 UTC, Jack wrote: actually i didnt so I just added: ```d shared static this() { Runtime.initialize(); } shared static ~this() { Runtime.terminate(); } ``` but it didn't change anything That doesn't work because `Runtime.initialize()` is respo

Re: how do i fix this node_dlang error?

2021-06-07 Thread frame via Digitalmars-d-learn
On Monday, 7 June 2021 at 02:33:38 UTC, Jack wrote: What am I missing? If this runs under Windows, there is no dlopen(), maybe a wrapper to LoadLibrary() but this will need to call a DllMain() in the DLL if I am not wrong. Is there a DllMain?

Re: how do i fix this node_dlang error?

2021-06-07 Thread Jack via Digitalmars-d-learn
On Monday, 7 June 2021 at 17:22:48 UTC, MoonlightSentinel wrote: On Monday, 7 June 2021 at 02:33:38 UTC, Jack wrote: What am I missing? Does your code / `node_dlang` initialize Druntime before calling `writeln`? actually i didnt so I just added: ```d shared static this() { Runtime.

Re: how do i fix this node_dlang error?

2021-06-07 Thread MoonlightSentinel via Digitalmars-d-learn
On Monday, 7 June 2021 at 02:33:38 UTC, Jack wrote: What am I missing? Does your code / `node_dlang` initialize Druntime before calling `writeln`? Try replacing the `writeln` with `puts` (from `core.stdc.stdio`) which doesn't require an initialized runtime.

Re: how do i fix this node_dlang error?

2021-06-06 Thread Jack via Digitalmars-d-learn
`dub build``` is fine but ```node example.js``` retuns an error saying the module.node is not a valid win32 application. How do I fix this? [1]: https://github.com/NotSpooky/node_dlang/tree/v0.4.11/examples Hello, I'm the author of the library. nice works, thanks for the library! Indee

Re: how do i fix this node_dlang error?

2021-06-06 Thread Jack via Digitalmars-d-learn
On Sunday, 6 June 2021 at 17:32:57 UTC, Mike Parker wrote: On Sunday, 6 June 2021 at 15:42:55 UTC, Jack wrote: 0.4.11\node_dlang\source\node_dlang.d(137,11): Error: none of the overloads of `this` are callable using argument types `(string, string, ulong, Throwable)`, candidates are

Re: how do i fix this node_dlang error?

2021-06-06 Thread NotSpooky via Digitalmars-d-learn
On Sunday, 6 June 2021 at 04:25:39 UTC, Jack wrote: I'm trying to use the node_dlang pakckage but the code example from [this repo](https://github.com/NotSpooky/node_dlang/tree/v0.4.11/examples) isn't working the command ```dub build``` is fine but ```node example.js``` retun

Re: how do i fix this node_dlang error?

2021-06-06 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 6 June 2021 at 15:42:55 UTC, Jack wrote: 0.4.11\node_dlang\source\node_dlang.d(137,11): Error: none of the overloads of `this` are callable using argument types `(string, string, ulong, Throwable)`, candidates are: C:\D\dmd2\windows\bin\..\..\src\druntime\import\object.d(2440,30

Re: how do i fix this node_dlang error?

2021-06-06 Thread Jack via Digitalmars-d-learn
`dub build``` is fine but ```node example.js``` retuns an error saying the module.node is not a valid win32 application. How do I fix this? [1]: https://github.com/NotSpooky/node_dlang/tree/v0.4.11/examples Looking at node_dlang's dub.json, it's building a DLL then renaming it to

Re: how do i fix this node_dlang error?

2021-06-06 Thread Jack via Digitalmars-d-learn
`dub build``` is fine but ```node example.js``` retuns an error saying the module.node is not a valid win32 application. How do I fix this? [1]: https://github.com/NotSpooky/node_dlang/tree/v0.4.11/examples Looking at node_dlang's dub.json, it's building a DLL then renaming it to

Re: how do i fix this node_dlang error?

2021-06-05 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 6 June 2021 at 04:25:39 UTC, Jack wrote: I'm trying to use the node_dlang pakckage but the code example from [this repo](https://github.com/NotSpooky/node_dlang/tree/v0.4.11/examples) isn't working the command ```dub build``` is fine but ```node example.js``` retun

how do i fix this node_dlang error?

2021-06-05 Thread Jack via Digitalmars-d-learn
I'm trying to use the node_dlang pakckage but the code example from [this repo](https://github.com/NotSpooky/node_dlang/tree/v0.4.11/examples) isn't working the command ```dub build``` is fine but ```node example.js``` retuns an error saying the module.node is not a valid win32 a

Re: dmd error in wsl2

2021-05-25 Thread bharathyes via Digitalmars-d-learn
using debian directly ( through the Terminal Preview app or within VS Code ). The recommended install script had me "activate" to use dmd and since that concept was out of my understanding, I re-installed dmd using `apt`. But it kept throwing that error and I just couldn't find

Re: dmd error in wsl2

2021-05-25 Thread bharathyes via Digitalmars-d-learn
On Tuesday, 25 May 2021 at 15:59:21 UTC, MoonlightSentinel wrote: On Tuesday, 25 May 2021 at 15:54:31 UTC, bharathyes wrote: I wrote the basic code: You have a typo in your code, `std.studio` instead of `std.stdio`. Thanks. I spent more than half hour searching for this error but never

Re: dmd error in wsl2

2021-05-25 Thread mw via Digitalmars-d-learn
eadf("%s\n", &name); writeln("Hellow ", name); } ``` This throws the following no compiling: ``` $ dmd hellow.d 21:16:13 hellow.d(2): Error: module `studio` is in file 'std/studio.d' which cannot be read import pat

Re: dmd error in wsl2

2021-05-25 Thread MoonlightSentinel via Digitalmars-d-learn
On Tuesday, 25 May 2021 at 15:54:31 UTC, bharathyes wrote: I wrote the basic code: You have a typo in your code, `std.studio` instead of `std.stdio`.

dmd error in wsl2

2021-05-25 Thread bharathyes via Digitalmars-d-learn
ot;, name); } ``` This throws the following no compiling: ``` $ dmd hellow.d 21:16:13 hellow.d(2): Error: module `studio` is in file 'std/studio.d' which cannot be read import path[0] = /usr/include/dmd/phobos import path[1] = /usr/inclu

Re: DMC + Win32Api: Error: undefined identifier 'SetDCBrushColor'

2021-05-17 Thread Marcone via Digitalmars-d-learn
Why gdi32.lib in dmc is not a Valid Library File?

Re: DMC + Win32Api: Error: undefined identifier 'SetDCBrushColor'

2021-05-16 Thread Marcone via Digitalmars-d-learn
On Sunday, 16 May 2021 at 15:43:51 UTC, Adam D. Ruppe wrote: On Sunday, 16 May 2021 at 14:51:56 UTC, Marcone wrote: Error: undefined identifier 'SetDCBrushColor' Did you include gdi32.lib on the command line? I got this error: C:\Users\Usuario\Arquivos\dm\lib\gdi32.lib Error

Re: DMC + Win32Api: Error: undefined identifier 'SetDCBrushColor'

2021-05-16 Thread Marcone via Digitalmars-d-learn
decided to test it. Creating a program with a win32api graphical interface I run into this error: Error: undefined identifier 'SetDCBrushColor' How to solve this problem? Thanks. if it's not one defined in one of the core.sys.windows module, export it yourself: ```d pragma(

Re: DMC + Win32Api: Error: undefined identifier 'SetDCBrushColor'

2021-05-16 Thread Jack via Digitalmars-d-learn
graphical interface I run into this error: Error: undefined identifier 'SetDCBrushColor' How to solve this problem? Thanks. if it's not one defined in one of the core.sys.windows module, export it yourself: ```d pragma(lib, "Gdi32.lib"); COLORREF SetDCBrushColor(

Re: DMC + Win32Api: Error: undefined identifier 'SetDCBrushColor'

2021-05-16 Thread Marcone via Digitalmars-d-learn
On Sunday, 16 May 2021 at 15:43:51 UTC, Adam D. Ruppe wrote: On Sunday, 16 May 2021 at 14:51:56 UTC, Marcone wrote: Error: undefined identifier 'SetDCBrushColor' Did you include gdi32.lib on the command line? Yes, I did it. But not work. I get this error: Error: undefined

Re: DMC + Win32Api: Error: undefined identifier 'SetDCBrushColor'

2021-05-16 Thread Adam D. Ruppe via Digitalmars-d-learn
On Sunday, 16 May 2021 at 14:51:56 UTC, Marcone wrote: Error: undefined identifier 'SetDCBrushColor' Did you include gdi32.lib on the command line?

DMC + Win32Api: Error: undefined identifier 'SetDCBrushColor'

2021-05-16 Thread Marcone via Digitalmars-d-learn
Well, I program in D as a hobby for just over a year, and I like to learn and explore this wonderful programming language. Now I found the DMC compiler that compiles C ++ code. So I decided to test it. Creating a program with a win32api graphical interface I run into this error: Error

Re: Any suggestions on dmd error message formatting?

2021-05-15 Thread SealabJaster via Digitalmars-d-learn
On Saturday, 15 May 2021 at 09:09:36 UTC, Berni44 wrote: ... Honestly, even having a dumb formatter that puts things like this would be 100x more useable than what we currently get: ```d das2.range.PriorityRange!( DasRange!( Take!( ZipShortest!( cast(Flag)false, Result, G

Re: Any suggestions on dmd error message formatting?

2021-05-15 Thread SealabJaster via Digitalmars-d-learn
On Saturday, 15 May 2021 at 08:15:19 UTC, Chris Piker wrote: I did much the same as you and reformatted the error message to find the bug. As to the larger question of how to automatically process compiler output... got any ideas? Hope someone who knows how to modify DMD bothers to: 1

Re: Any suggestions on dmd error message formatting?

2021-05-15 Thread Berni44 via Digitalmars-d-learn
On Saturday, 15 May 2021 at 04:54:15 UTC, Chris Piker wrote: As always, your advice is much appreciated I'm usually piping the results through hexdump. ;-) No, in earnest, I often would have liked to have better formatted messages. The only thing I can say: Sometimes it helps to increase the

Re: Any suggestions on dmd error message formatting?

2021-05-15 Thread Chris Piker via Digitalmars-d-learn
meter needs to accept a `Tuple!(int, int)` I did much the same as you and reformatted the error message to find the bug. As to the larger question of how to automatically process compiler output... got any ideas? Hey since you're pretty good at this, can you tell me why how a person fixes

Re: Any suggestions on dmd error message formatting?

2021-05-14 Thread SealabJaster via Digitalmars-d-learn
On Saturday, 15 May 2021 at 06:12:25 UTC, SealabJaster wrote: ... Honestly I also kind of wish that the D compilers could format functions better on the command line, because these giant blobs of "where's ~~wally~~ the difference?" are just horrid when they show up.

Re: Any suggestions on dmd error message formatting?

2021-05-14 Thread SealabJaster via Digitalmars-d-learn
On Saturday, 15 May 2021 at 04:54:15 UTC, Chris Piker wrote: Hi D T_T My eyes burn. Anyway, Here it is formatted slightly better: ```d PriorityRange.this( DasRange!( Tuple!(int, int)[], int function(Tuple!(int, int)) pure nothrow @nogc @safe,

Any suggestions on dmd error message formatting?

2021-05-14 Thread Chris Piker via Digitalmars-d-learn
Hi D So the compile error messages getting from dmd are starting to remind me of the notorious 130 line error message I once got from a C++ compiler for missing a comma in a template. :-/ (After fixing that bug, I left work early and came back the next day with a python book.) So, like

Re: bindbc.sfml , sfVideoMode , Error: undefined identifier

2021-05-08 Thread Alain De Vos via Digitalmars-d-learn
After adding ``` "versions": [ "SFML_Audio", "SFML_Graphics", "SFML_250", ] ``` to dub.json it compiles. The sfml library the freebsd os is version : "sfml-2.5.1_2" .

Re: bindbc.sfml , sfVideoMode , Error: undefined identifier

2021-05-08 Thread Dennis via Digitalmars-d-learn
On Saturday, 8 May 2021 at 09:05:18 UTC, Alain De Vos wrote: I must doing something wrong ? Did you define the `SFML_Graphics` version like in the README of bindbc-sfml?

bindbc.sfml , sfVideoMode , Error: undefined identifier

2021-05-08 Thread Alain De Vos via Digitalmars-d-learn
I try this, ``` import bindbc.sfml; import bindbc.sfml.config; import bindbc.sfml.system; import bindbc.sfml.window; void main(){ bool ret=loadSFML(); sfVideoMode m=sfVideoMode(800, 600,24); } ``` But dub gives undefined identifier sdVideoMode. Although, https://bindbc-sfml.dpldocs

Re: String concatenation segmentation error

2021-04-23 Thread Imperatorn via Digitalmars-d-learn
On Thursday, 22 April 2021 at 21:15:48 UTC, tcak wrote: string fileContent = ""; ... [...] Do you have a minimal reproducible test case? 🤔

Re: String concatenation segmentation error

2021-04-22 Thread Adam D. Ruppe via Digitalmars-d-learn
On Friday, 23 April 2021 at 00:44:58 UTC, tcak wrote: As far as I see, it is not related to that array or indices at all. The question of where is to see if it was CTFE allocated or runtime allocated. I don't think it should make a difference here but idk. If there is no known situation th

Re: String concatenation segmentation error

2021-04-22 Thread tcak via Digitalmars-d-learn
l, all of them cause segmentation fault with error: _D2gc4impl12conservativeQw3Gcx10smallAllocMFNbmKmkxC8TypeInfoZPv () When I comment out those piece of codes, there is no error. If there is no known situation that would cause this, I will need to update codes to C-style pre-allocate buffer and copy i

Re: String concatenation segmentation error

2021-04-22 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 22 April 2021 at 21:15:48 UTC, tcak wrote: "positions" array is defined as auto positions = new float[ 100 ]; So, I am 100% sure, it is not out of range. "ri*dim + 1" is not a big number at all. Oh and *where* is that positions variable defined?

Re: String concatenation segmentation error

2021-04-22 Thread Adam D. Ruppe via Digitalmars-d-learn
Are there any other threads in your program?

Re: String concatenation segmentation error

2021-04-22 Thread tcak via Digitalmars-d-learn
In other parts of the code, concatenation operations are all failing with same error. I need guidance to get out of this situation. My assumption was that as long as there is empty heap memory, concatenation operation would succeed always. But, it doesn't seem like so.

String concatenation segmentation error

2021-04-22 Thread tcak via Digitalmars-d-learn
ll allocation. I remember I had this problem before in another project. I have enough free ram. htop shows 3.96 GiB of 8 GiB is used only and swap is not in use. DMD64 D Compiler v2.094.0 Is this error related to me? Is it a programmer error? Is it a bug? Am I doing something wrong? This is a compiler related operation (string concatenation), and I assume/expect that it would work without a problem.

Re: DUB Error with packcage dformlib

2021-04-18 Thread Alain De Vos via Digitalmars-d-learn
For some weird reason , https://code.dlang.org Has lots of packages without maintainer ... Git repositories which are put read-only ... I.e. no "Issues"

Re: DUB Error with packcage dformlib

2021-04-18 Thread Marcone via Digitalmars-d-learn
On Sunday, 18 April 2021 at 07:31:12 UTC, Imperatorn wrote: On Sunday, 18 April 2021 at 01:37:14 UTC, Marcone wrote: I have this message when try build dub. How solve it? Unresolvable dependencies to package dformlib app ~master depends on dformlib ~0.2.2> Just a comment, dforms is millions o

Re: DUB Error with packcage dformlib

2021-04-18 Thread Imperatorn via Digitalmars-d-learn
On Sunday, 18 April 2021 at 01:37:14 UTC, Marcone wrote: I have this message when try build dub. How solve it? Unresolvable dependencies to package dformlib app ~master depends on dformlib ~0.2.2> Just a comment, dforms is millions of years old. It would be nice to see support for it again, b

Re: DUB Error with packcage dformlib

2021-04-17 Thread Alain De Vos via Digitalmars-d-learn
It might be a dead monkey. You could try: https://github.com/o3o/dguihub

DUB Error with packcage dformlib

2021-04-17 Thread Marcone via Digitalmars-d-learn
I have this message when try build dub. How solve it? Unresolvable dependencies to package dformlib app ~master depends on dformlib ~0.2.2>

Re: Range Error

2021-04-15 Thread martinm via Digitalmars-d-learn
On Sunday, 11 April 2021 at 19:48:42 UTC, Ruby The Roobster wrote: On Sunday, 11 April 2021 at 19:45:30 UTC, Ruby The Roobster wrote: What am I doing wrong here? Is it the 'for' loop? Nevermind. I messed up what line it was. It was actually this line: ```d square[i][j] = new Square(Color.non

Re: Range Error

2021-04-12 Thread Imperatorn via Digitalmars-d-learn
On Monday, 12 April 2021 at 19:19:12 UTC, kdevel wrote: On Monday, 12 April 2021 at 18:13:38 UTC, Imperatorn wrote: [...] [...] D can be so much fun! ```d import std.stdio; [...] Of course :D

Re: Range Error

2021-04-12 Thread kdevel via Digitalmars-d-learn
On Monday, 12 April 2021 at 18:13:38 UTC, Imperatorn wrote: [...] Yup D can be so much fun! ```d import std.stdio; enum Color {none = " n ", red = " r ", black = " b "}; enum sColor {black= " b ", white= " w "}; class Square { public: this(Color color, sColor Scolor) { this.color

Re: Range Error

2021-04-12 Thread Imperatorn via Digitalmars-d-learn
On Monday, 12 April 2021 at 18:01:02 UTC, kdevel wrote: On Sunday, 11 April 2021 at 20:41:35 UTC, Bastiaan Veelo wrote: [...] [...] Yes, there is a `7` where there should be an `i` on this line: ```d for(int i=7;7>=0;i--) ``` This will go on forever, so you get a range error as soon as

Re: Range Error

2021-04-12 Thread kdevel via Digitalmars-d-learn
On Sunday, 11 April 2021 at 20:41:35 UTC, Bastiaan Veelo wrote: [...] What am I doing wrong here? Is it the 'for' loop? Yes, there is a `7` where there should be an `i` on this line: ```d for(int i=7;7>=0;i--) ``` This will go on forever, so you get a range error as so

Re: Range Error

2021-04-12 Thread Ruby The Roobster via Digitalmars-d-learn
this line: ```d   for(int i=7;7>=0;i--) ``` This will go on forever, so you get a range error as soon as `i < 0`. ... I fixed the code now. It works. Thanks for your help.

Re: Range Error

2021-04-12 Thread Ruby The Roobster via Digitalmars-d-learn
is will go on forever, so you get a range error as soon as `i < 0`. —Bastiaan. I have fixed this.

Re: Range Error

2021-04-11 Thread Steven Schveighoffer via Digitalmars-d-learn
so you get a range error as soon as `i < 0`. Also this code is wrong: ```d for(int i=2;i>=0;i--) { for(int j=7;i>=0;j--) ``` For that j loop, i will always be 2, so it will not terminate until the range error happens. Should probably be: for(int j=7; j >= 0; j--)

Re: Range Error

2021-04-11 Thread Bastiaan Veelo via Digitalmars-d-learn
On Sunday, 11 April 2021 at 19:45:30 UTC, Ruby The Roobster wrote: What am I doing wrong here? Is it the 'for' loop? Yes, there is a `7` where there should be an `i` on this line: ```d for(int i=7;7>=0;i--) ``` This will go on forever, so you get a range error as so

Re: Range Error

2021-04-11 Thread Ruby The Roobster via Digitalmars-d-learn
On Sunday, 11 April 2021 at 19:45:30 UTC, Ruby The Roobster wrote: What am I doing wrong here? Is it the 'for' loop? Nevermind. I messed up what line it was. It was actually this line: ```d square[i][j] = new Square(Color.none, sColor.white); ```

Range Error

2021-04-11 Thread Ruby The Roobster via Digitalmars-d-learn
So, here is the full code: ```d enum Color {none=0,red=1,black=2}; enum sColor {black=0,white=1}; class Square { public: this(Color color, sColor Scolor) { this.color = color; this.Scolor = Scolor; } Color color; sColor Scolor; } import std.stdio; void cPrintboard(Square[8

Error when running dmd compilable tests

2021-04-11 Thread Per Nordlöw via Digitalmars-d-learn
Inside dmd source tree, under sub-directory test, I do ./run.d compilable/ . This errors as ``` ... compilable/json.d -d -preview=dip1000 -o- -X -Xf/home/per/Work/dmd/test/test_results/compilable/json.out -fPIC ()== Test 'compilable/json.d' fail

Re: Strange error

2021-03-23 Thread Nicholas Wilson via Digitalmars-d-learn
On Monday, 22 March 2021 at 07:52:14 UTC, MichaelJames wrote: Tell me, did you manage to solve this problem? https://github.com/dlang/dmd/pull/12300

Re: Strange error

2021-03-22 Thread MichaelJames via Digitalmars-d-learn
(); // Error: expression __lambda1 is not a valid template value argument smpl.func2(); // Error: expression __lambda2 is not a valid template value argument } void main(){ enum s = Sample( {writeln("Hello world1");}, {writeln("Hello world2");} ); s.func1();

Re: Strange error

2021-03-21 Thread Steven Schveighoffer via Digitalmars-d-learn
On 3/21/21 3:18 AM, Jack Applegame wrote: Could someone please explain what is wrong with this code? https://glot.io/snippets/fwxn2198kv ```d import std.stdio; struct Sample{   void function() func1;   void function() func2; } void noth(Sample smpl)() {   smpl.func1(); // Error

Re: Strange error

2021-03-21 Thread Jack Applegame via Digitalmars-d-learn
function() func2; } void noth(Sample smpl)() { smpl.func1(); // Error: expression __lambda1 is not a valid template value argument smpl.func2(); // Error: expression __lambda2 is not a valid template value argument } void main(){ enum s = Sample( {writeln("Hello world1");},

Re: Strange error

2021-03-21 Thread Imperatorn via Digitalmars-d-learn
(); // Error: expression __lambda1 is not a valid template value argument smpl.func2(); // Error: expression __lambda2 is not a valid template value argument } void main(){ enum s = Sample( {writeln("Hello world1");}, {writeln("Hello world2");} ); s.func1();

Strange error

2021-03-21 Thread Jack Applegame via Digitalmars-d-learn
Could someone please explain what is wrong with this code? https://glot.io/snippets/fwxn2198kv ```d import std.stdio; struct Sample{ void function() func1; void function() func2; } void noth(Sample smpl)() { smpl.func1(); // Error: expression __lambda1 is not a valid template value

Re: Using YMM registers causes an undefined label error

2021-03-19 Thread z via Digitalmars-d-learn
On Tuesday, 9 March 2021 at 20:33:01 UTC, z wrote: On Tuesday, 9 March 2021 at 20:23:48 UTC, z wrote: On Friday, 5 March 2021 at 12:57:43 UTC, z wrote: ... Then it seems the only way to get AVX-compatible inline assembly(ldc.llvmasm excluded) is to use an external assembler. For example :

Re: Very confusing error message when calling a class method from an invariant

2021-03-09 Thread Meta via Digitalmars-d-learn
On Wednesday, 10 March 2021 at 04:57:19 UTC, Paul Backus wrote: On Wednesday, 10 March 2021 at 03:39:15 UTC, Meta wrote: class Human { static immutable MAX_AGE = 122; bool alive = true; int age = 0; //Error: mutable method onlineapp.Human.checkAge is not callable using a const

Re: Very confusing error message when calling a class method from an invariant

2021-03-09 Thread Paul Backus via Digitalmars-d-learn
On Wednesday, 10 March 2021 at 03:39:15 UTC, Meta wrote: class Human { static immutable MAX_AGE = 122; bool alive = true; int age = 0; //Error: mutable method onlineapp.Human.checkAge is not callable using a const object invariant(checkAge()); [...] What the hell does

Very confusing error message when calling a class method from an invariant

2021-03-09 Thread Meta via Digitalmars-d-learn
class Human { static immutable MAX_AGE = 122; bool alive = true; int age = 0; //Error: mutable method onlineapp.Human.checkAge is not callable using a const object invariant(checkAge()); void growOlder() in(alive) out(; checkAge()) { age

Re: Using YMM registers causes an undefined label error

2021-03-09 Thread z via Digitalmars-d-learn
On Tuesday, 9 March 2021 at 20:23:48 UTC, z wrote: On Friday, 5 March 2021 at 12:57:43 UTC, z wrote: ... Then it seems the only way to get AVX-compatible inline assembly(ldc.llvmasm excluded) is to use an external assembler. For example : ... But i'm not really sure how to integrate that i

Re: Using YMM registers causes an undefined label error

2021-03-09 Thread z via Digitalmars-d-learn
On Friday, 5 March 2021 at 12:57:43 UTC, z wrote: ... Then it seems the only way to get AVX-compatible inline assembly(ldc.llvmasm excluded) is to use an external assembler. For example : import std.stdio; extern(C) void vxorps_d(ubyte[32]*); void main() { ubyte[32] a = 2;

Re: dmd -> ldmd2: /usr/bin/ld.gold: error: .o: multiple definition of 'bool ldc.attributes...

2021-03-07 Thread kdevel via Digitalmars-d-learn
On Sunday, 7 March 2021 at 12:47:45 UTC, kinke wrote: [...] ./dmd -i -of=pointless.o -g -c pointless/package.d "dmd" is a symlink to /opt/ldc2/bin/ldmd2 Ah, try using `-i=-ldc` instead of `-i` alone to manually exclude the ldc.* modules from being included. Solved the issue. Many thanks!

Re: dmd -> ldmd2: /usr/bin/ld.gold: error: .o: multiple definition of 'bool ldc.attributes...

2021-03-07 Thread kinke via Digitalmars-d-learn
On Sunday, 7 March 2021 at 11:34:08 UTC, kdevel wrote: ./dmd -i -I=tillyscop:tillyscop/msgpack-d/src -O -g -of=localscop.o -c tillyscop/scop.d tillyscop/scopserializer.d and ./dmd -i -of=pointless.o -g -c pointless/package.d "dmd" is a symlink to /opt/ldc2/bin/ldmd2 Ah, try using `-i=-ldc`

Re: dmd -> ldmd2: /usr/bin/ld.gold: error: .o: multiple definition of 'bool ldc.attributes...

2021-03-07 Thread kdevel via Digitalmars-d-learn
On Sunday, 7 March 2021 at 11:50:45 UTC, z wrote: [...] I think i had a similar error, can you try adding version(LDC) pragma(LDC_no_moduleinfo) to the affected modules? At the line just after the module declaration, particularly in all package.d files and the file that contains the main

Re: dmd -> ldmd2: /usr/bin/ld.gold: error: .o: multiple definition of 'bool ldc.attributes...

2021-03-07 Thread z via Digitalmars-d-learn
ideally I want to reuse my Makefile). I think i had a similar error, can you try adding version(LDC) pragma(LDC_no_moduleinfo) to the affected modules? At the line just after the module declaration, particularly in all package.d files and the file that contains the main function. However, your

Re: dmd -> ldmd2: /usr/bin/ld.gold: error: .o: multiple definition of 'bool ldc.attributes...

2021-03-07 Thread kdevel via Digitalmars-d-learn
On Sunday, 7 March 2021 at 01:29:50 UTC, Preetpal wrote: [...] Can you post more information? Like the full error that you are seeing, [link cmd] /usr/bin/ld.gold: error: pointless.o: multiple definition of '_D3ldc10attributes10assumeUsedySQBeQBd11_assumeUsed' /usr/bin/ld.gold: l

Re: dmd -> ldmd2: /usr/bin/ld.gold: error: .o: multiple definition of 'bool ldc.attributes...

2021-03-06 Thread Preetpal via Digitalmars-d-learn
ideally I want to reuse my Makefile). Can you post more information? Like the full error that you are seeing, the command you are forced to use to allow everything to compile, the platform that you are on (Mac, BSD, Linux, etc.).

dmd -> ldmd2: /usr/bin/ld.gold: error: .o: multiple definition of 'bool ldc.attributes...

2021-03-06 Thread kdevel via Digitalmars-d-learn
After replacing dmd with ldmd2 (LDC 1.25.1) I get tons of link errors all of the form mentioned in the subject. Any idea what can be done about it? (With a handcrafted single compile/link statement using ldc2 everything compiles but ideally I want to reuse my Makefile).

Re: Using YMM registers causes an undefined label error

2021-03-06 Thread Guillaume Piolat via Digitalmars-d-learn
On Saturday, 6 March 2021 at 16:09:03 UTC, Imperatorn wrote: On Saturday, 6 March 2021 at 15:40:56 UTC, Rumbu wrote: On Saturday, 6 March 2021 at 12:15:43 UTC, Mike Parker wrote: [...] Where exactly is documented the extern(D) x86-64 calling convention? Because currently seems like a mess ac

Re: Using YMM registers causes an undefined label error

2021-03-06 Thread Imperatorn via Digitalmars-d-learn
On Saturday, 6 March 2021 at 15:40:56 UTC, Rumbu wrote: On Saturday, 6 March 2021 at 12:15:43 UTC, Mike Parker wrote: [...] Where exactly is documented the extern(D) x86-64 calling convention? Because currently seems like a mess according to the dissasembly. First X parameters on stack from

Re: Using YMM registers causes an undefined label error

2021-03-06 Thread Rumbu via Digitalmars-d-learn
On Saturday, 6 March 2021 at 12:15:43 UTC, Mike Parker wrote: On Saturday, 6 March 2021 at 11:57:13 UTC, Imperatorn wrote: What... Is this really how it's supposed to be? Makes no sense to not use any of the existing conventions. extern(C) and extern(D) are both documented to be the same as

Re: Using YMM registers causes an undefined label error

2021-03-06 Thread kinke via Digitalmars-d-learn
On Saturday, 6 March 2021 at 12:29:07 UTC, kinke wrote: There are other slight breakages of that 'spec', e.g., LDC's extern(D) ABI is very similar to Microsoft's __vectorcall (so that e.g. vectors are passed in registers). [Windows only, to prevent any more confusion.]

Re: Using YMM registers causes an undefined label error

2021-03-06 Thread kinke via Digitalmars-d-learn
On Saturday, 6 March 2021 at 12:15:43 UTC, Mike Parker wrote: On Saturday, 6 March 2021 at 11:57:13 UTC, Imperatorn wrote: What... Is this really how it's supposed to be? Makes no sense to not use any of the existing conventions. extern(C) and extern(D) are both documented to be the same as

Re: Using YMM registers causes an undefined label error

2021-03-06 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 6 March 2021 at 11:57:13 UTC, Imperatorn wrote: What... Is this really how it's supposed to be? Makes no sense to not use any of the existing conventions. extern(C) and extern(D) are both documented to be the same as the platform's C calling convention everywhere except x86 windo

Re: Using YMM registers causes an undefined label error

2021-03-06 Thread kinke via Digitalmars-d-learn
On Friday, 5 March 2021 at 12:57:43 UTC, z wrote: XMM registers work, but as soon as they are changed into YMM DMD outputs "bad type/size of operands %s" and LDC outputs an "label YMM0 is undefined" error. Are they not supported? To illutrate : https://run.dlang.io/is/Iq

Re: Using YMM registers causes an undefined label error

2021-03-06 Thread Imperatorn via Digitalmars-d-learn
On Saturday, 6 March 2021 at 10:45:08 UTC, Rumbu wrote: On Friday, 5 March 2021 at 21:47:49 UTC, z wrote: [...] I just made some tests, it seems that D has invented his own calling convention. And it's not documented. If you decorate your function with extern(C) it should respect the x86-64

Re: Using YMM registers causes an undefined label error

2021-03-06 Thread Rumbu via Digitalmars-d-learn
, not 2. You're absolutely right, but apparently it only accepts the two-operand version from SSE. Other AVX/AVX2/AVX512 instructions that have «v» prefixed aren't recognized either("Error: unknown opcode vmovaps"), is AVX(2) with YMM registers supported for «asm{}» statements?

Re: Using YMM registers causes an undefined label error

2021-03-05 Thread z via Digitalmars-d-learn
it only accepts the two-operand version from SSE. Other AVX/AVX2/AVX512 instructions that have «v» prefixed aren't recognized either("Error: unknown opcode vmovaps"), is AVX(2) with YMM registers supported for «asm{}» statements?

Re: Using YMM registers causes an undefined label error

2021-03-05 Thread Rumbu via Digitalmars-d-learn
On Friday, 5 March 2021 at 12:57:43 UTC, z wrote: XMM registers work, but as soon as they are changed into YMM DMD outputs "bad type/size of operands %s" and LDC outputs an "label YMM0 is undefined" error. Are they not supported? To illutrate : https://run.dlang.io/is/IqD

Using YMM registers causes an undefined label error

2021-03-05 Thread z via Digitalmars-d-learn
XMM registers work, but as soon as they are changed into YMM DMD outputs "bad type/size of operands %s" and LDC outputs an "label YMM0 is undefined" error. Are they not supported? To illutrate : https://run.dlang.io/is/IqDHlK By the way, how can i use instructions that a

<    1   2   3   4   5   6   7   8   9   10   >