www.digitalmars.com         C & C++   DMDScript  

D.gnu - nasty C func

reply Denis R <denis_r telkomsa.net> writes:
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);
}
Jun 17 2005
parent reply Tom S <h3r3tic remove.mat.uni.torun.pl> writes:
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 +/
Jun 17 2005
parent Denis R <denis_r telkomsa.net> writes:
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 +/
Jun 18 2005