Note that there are some explanatory texts on larger screens.

plurals
  1. POncurses api with the D Programming Language
    text
    copied!<p>I am trying to teach myself AI using neural networks. Long story short, I wanted to create a simple graphic that would display what is happening in my program using ncurses. The tutorial that I am using is found <a href="http://www.ai-junkie.com/ann/evolved/nnt1.html" rel="nofollow noreferrer">here</a>.</p> <p>I was under the impression that D was compatible with C and I could theoretically call C functions relatively easily.</p> <p>I find that not to be the case. I am a relatively novice programmer, so even the simplistic explanations are a little above my head. I found this <a href="http://www.digitalmars.com/d/2.0/interfaceToC.html" rel="nofollow noreferrer">here</a>.</p> <blockquote> <p>D is designed to fit comfortably with a C compiler for the target system. D makes up for not having its own VM by relying on the target environment's C runtime library. It would be senseless to attempt to port to D or write D wrappers for the vast array of C APIs available. How much easier it is to just call them directly.</p> <p>This is done by matching the C compiler's data types, layouts, and function call/return sequences. </p> </blockquote> <p>That sounds wonderful. A little bit over my head. I tested and got a simple C program working:</p> <pre><code>#include &lt;curses.h&gt; int main(void) { int ch; initscr(); noecho(); cbreak(); printw("Hit Ctrl+C to exit ...\n\n"); for (;;) { ch = getch(); printw("Value of char: %d (%02x)\n", ch, ch); } endwin(); return 0; } </code></pre> <p>shamelessly copied and pasted from another question on SO. At least I did my homework.</p> <p>I tried basically the same thing from a simple D program. I got this error:</p> <pre><code>Error: module curses is in file 'curses.d' which cannot be read </code></pre> <p>I am absolutely positive that I am trying something really stupid.</p> <p>Is there an easy way to use ncurses in a D program?</p> <p>I'm running on zero sleep and caffeine, so please be gentle! Even a link to a website would be greatly appreciated!</p> <p>I probably didn't include everything that I should have, so AMA.</p> <p>And feel free to insult my intelligence.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload