Error

2022-10-30 Thread Decabytes via Digitalmars-d-learn
I'm trying to write a chip8 emulator. I'm at the step where I load the rom into the memory. According to the [documentation](http://devernay.free.fr/hacks/chip8/C8TECH10.HTM#3.0) each instruction is 2 bytes and max memory addressed is 4K. So I define the memory as an array of ushorts. ```D stru

Re: overloading main

2022-10-30 Thread NonNull via Digitalmars-d-learn
On Sunday, 30 October 2022 at 18:24:22 UTC, Adam D Ruppe wrote: it prolly just to keep newbs from making confusing mistakes and getting weird behavior at startup. If there's two mains, which one is the expected entry? Perhaps it could just be the one that matches the permitted signature, and if

Re: overloading main

2022-10-30 Thread NonNull via Digitalmars-d-learn
On Sunday, 30 October 2022 at 17:41:07 UTC, Imperatorn wrote: On Sunday, 30 October 2022 at 17:29:25 UTC, NonNull wrote: On Sunday, 30 October 2022 at 16:31:45 UTC, Imperatorn wrote: You should not have multiple mains. Rename it and call it Doesn't answer my questions. I wasn't asking for pra

Re: overloading main

2022-10-30 Thread Adam D Ruppe via Digitalmars-d-learn
On Sunday, 30 October 2022 at 16:09:54 UTC, NonNull wrote: I am linking to a C project with some C already automatically translated into D including the C main function `int main(int argc, char** argv){/* ... */}` which I wanted to call from a D main function in a new module. did you put exte

Re: overloading main

2022-10-30 Thread Imperatorn via Digitalmars-d-learn
On Sunday, 30 October 2022 at 17:29:25 UTC, NonNull wrote: On Sunday, 30 October 2022 at 16:31:45 UTC, Imperatorn wrote: You should not have multiple mains. Rename it and call it Doesn't answer my questions. I wasn't asking for practical, moral or esthetic advice. Try to phrase your questio

Re: overloading main

2022-10-30 Thread NonNull via Digitalmars-d-learn
On Sunday, 30 October 2022 at 16:31:45 UTC, Imperatorn wrote: You should not have multiple mains. Rename it and call it Doesn't answer my questions. I wasn't asking for practical, moral or esthetic advice.

Re: overloading main

2022-10-30 Thread Imperatorn via Digitalmars-d-learn
On Sunday, 30 October 2022 at 16:09:54 UTC, NonNull wrote: I am linking to a C project with some C already automatically translated into D including the C main function `int main(int argc, char** argv){/* ... */}` which I wanted to call from a D main function in a new module. But then I found t

overloading main

2022-10-30 Thread NonNull via Digitalmars-d-learn
I am linking to a C project with some C already automatically translated into D including the C main function `int main(int argc, char** argv){/* ... */}` which I wanted to call from a D main function in a new module. But then I found that the former C main in D will not compile! ldc2 complains

Re: Applied fix to Dub (Was: ImportC in a Dub project )

2022-10-30 Thread Imperatorn via Digitalmars-d-learn
On Sunday, 30 October 2022 at 14:42:55 UTC, Carsten Schlote wrote: On Sunday, 30 October 2022 at 13:38:23 UTC, Imperatorn wrote: [...] I will merge the two PRs into a new patchset, and also add appropriate code to search für {c|i|h} files at the right places. The patchset should be as minima

Re: Applied fix to Dub (Was: ImportC in a Dub project )

2022-10-30 Thread Carsten Schlote via Digitalmars-d-learn
On Sunday, 30 October 2022 at 13:38:23 UTC, Imperatorn wrote: On Sunday, 30 October 2022 at 12:46:10 UTC, Carsten Schlote wrote: It turned out, that the required changes to add support for C files in Dub are really small. So I added a PR (https://github.com/dlang/dub/pull/2521). There is also s

Re: Applied fix to Dub (Was: ImportC in a Dub project )

2022-10-30 Thread Imperatorn via Digitalmars-d-learn
On Sunday, 30 October 2022 at 12:46:10 UTC, Carsten Schlote wrote: It turned out, that the required changes to add support for C files in Dub are really small. So I added a PR (https://github.com/dlang/dub/pull/2521). There is also some other PR (https://github.com/dlang/dub/pull/2270) releated

Applied fix to Dub (Was: ImportC in a Dub project )

2022-10-30 Thread Carsten Schlote via Digitalmars-d-learn
It turned out, that the required changes to add support for C files in Dub are really small. So I added a PR (https://github.com/dlang/dub/pull/2521). There is also some other PR (https://github.com/dlang/dub/pull/2270) releated to C file support in Dub. With my PR (2521) applied I can now co

Re: ImportC in a Dub project

2022-10-30 Thread Carsten Schlote via Digitalmars-d-learn
On Friday, 28 October 2022 at 19:08:47 UTC, Steven Schveighoffer wrote: By default dub does not build C files (as evidenced by your command line). It may not even let you I don't know, but try: ```json "sourceFiles" : ["source/zstdc_binding.c"] ``` Ok, this works. So Dub is not picking any