Thread overview
nasty C func
Jun 18, 2005
Denis R
Jun 18, 2005
Tom S
Jun 18, 2005
Denis R
June 18, 2005
Hello,

Im trying to call an ncurses funcion whline(WINDOW *, chtype, int);
which, judging from the ncurses.h is not a macro and gcc -E does not replace it seems :)

But, the problem is, it just does nothing seems.  I mean, equivalent code  like this:

initscr();
whline(stdscr, 4194417, 20);
napms(200);
endwin();

in C , draws a 20 col line, but, in D (provided relevant extern (C) is done),  does not draw a line (the screen/window setup
is ok, and rest).



And, i dont see an error :)



Yeah, extern looks like this  (not compiling)

extern(C)
{
  struct _win_st;
  _win_st* stdscr;
  _win_st* initscr();
  int refresh();
  int endwin();
  int napms(int);
  int whline(_win_st *win, ulong ch, int n);
}
June 18, 2005
Denis R wrote:
> Hello, 
> 
> Im trying to call an ncurses funcion whline(WINDOW *, chtype, int);
> which, judging from the ncurses.h is not a macro and gcc -E does not replace it seems :)
> 
> But, the problem is, it just does nothing seems.  I mean, equivalent code  like this:
> 
> (...)
> 
> extern(C)
> {
>   struct _win_st;
>   _win_st* stdscr;
>   _win_st* initscr();
>   int refresh();
>   int endwin();
>   int napms(int);
>   int whline(_win_st *win, ulong ch, int n);
> }

Are you sure that the second parameter of whline should be an ulong ? In D it's a 64 bit integer...


-- 
Tomasz Stachowiak  /+ a.k.a. h3r3tic +/
June 18, 2005
On Sat, 18 Jun 2005 04:50:36 +0200
Tom S <h3r3tic@remove.mat.uni.torun.pl> wrote:

Oh !

:P  Thanks, I didnt even think for a sec about that difference (err, not that I looked carefully at types)

Thanks again, its actually working

> Denis R wrote:
> > Hello,
> > 
> > Im trying to call an ncurses funcion whline(WINDOW *, chtype, int);
> > which, judging from the ncurses.h is not a macro and gcc -E does not replace it seems :)
> > 
> > But, the problem is, it just does nothing seems.  I mean, equivalent code  like this:
> > 
> > (...)
> > 
> > extern(C)
> > {
> >   struct _win_st;
> >   _win_st* stdscr;
> >   _win_st* initscr();
> >   int refresh();
> >   int endwin();
> >   int napms(int);
> >   int whline(_win_st *win, ulong ch, int n);
> > }
> 
> Are you sure that the second parameter of whline should be an ulong ? In D it's a 64 bit integer...
> 
> 
> -- 
> Tomasz Stachowiak  /+ a.k.a. h3r3tic +/