Microsoft KB Archive/37290

From BetaArchive Wiki
< Microsoft KB Archive
Revision as of 10:28, 21 July 2020 by X010 (talk | contribs) (Text replacement - ">" to ">")

Unresolved External C Functions May Be Macros

PSS ID Number: Q37290 Article last modified on 11- 7-1988

3.30 3.31 XENIX

Problem: I keep getting an unresolved external error from the linker even though I’m including the library that includes the function. I can compile and link the function from C but not from FORTRAN.

Response: Check the include files necessary for using the C function. The function may be a macro declaration involving another similar function. You may have to expand the macros yourself. Below is an example of a group of screen calls from the XENIX system. Note that the generic function addstr(str) is defined as waddstr(stdscr,str), stdscr being the standard screen, and so forth. The following is an example: extern WINDOW stdscr, curscr; >from /usr/include/curses.h : # define addch(ch) VOID(waddch(stdscr, ch)) # define getch() VOID(wgetch(stdscr)) # define addstr(str) VOID(waddstr(stdscr, str)) # define getstr(str) VOID(wgetstr(stdscr, str)) # define move(y, x) VOID(wmove(stdscr, y, x)) # define clear() VOID(wclear(stdscr)) # define erase() VOID(werase(stdscr)) # define clrtobot() VOID(wclrtobot(stdscr)) # define clrtoeol() VOID(wclrtoeol(stdscr)) # define insertln() VOID(winsertln(stdscr)) # define deleteln() VOID(wdeleteln(stdscr)) # define refresh() VOID(wrefresh(stdscr)) # define inch() VOID(winch(stdscr)) # define insch(c) VOID(winsch(stdscr,c)) # define delch() VOID(wdelch(stdscr)) # define standout() VOID(wstandout(stdscr)) # define standend() VOID(wstandend(stdscr)) # define mvaddch(y,x,ch) mvwaddch(stdscr,y,x,ch) # define mvgetch(y,x) mvwgetch(stdscr,y,x) # define mvaddstr(y,x,str) mvwaddstr(stdscr,y,x,str) # define mvgetstr(y,x,str) mvwgetstr(stdscr,y,x,str) # define mvinch(y,x) mvwinch(stdscr,y,x) # define mvdelch(y,x) mvwdelch(stdscr,y,x) # define mvinsch(y,x,c) mvwinsch(stdscr,y,x,c) ———————————————————————- The following is an example FORTRAN program: This is an example of how you must use the ‘addstr(str)’ and ‘refresh()’ functions provided by the Xenix system. ……………………………………………………………… INTERFACE TO INTEGER4 FUNCTION INITSC + [C,ALIAS:‘initscr’] () END INTERFACE TO INTEGER2 FUNCTION ADSTR + [C,ALIAS:‘waddstr’] (WIN,STR[REFERENCE]) INTEGER4 WIN CHARACTER30 STR END INTERFACE TO INTEGER2 FUNCTION REFRSH + [C,ALIAS:‘wrefresh’] (WIN) INTEGER4 WIN END INTEGER4 INITSC,POINT INTEGER2 ADSTR,REFRSH,RETURN CHARACTER30 STR POINT = INITSC() WRITE (,*) POINT STR = ‘Hello Mom !’ STR(28:) = CHAR(0) RETURN = ADSTR(POINT,STR) RETURN = REFRSH(POINT) END …………………………………………………………….