Path: utzoo!utgpu!attcan!uunet!lll-winken!lll-tis!ames!ll-xn!husc6!rutgers!mcnc!rti!bdrc!jcl From: jcl@bdrc.UUCP (John C. Lusth) Newsgroups: comp.lang.c Subject: near and far in MSC Message-ID: <331@bdrc.UUCP> Date: 28 Jul 88 20:18:24 GMT Organization: Becton Dickinson Research Cntr, RTP, NC Lines: 37 I'm porting some software, written in C, from a SUN to an IBM PC. The program is small but does a fair bit of dynamic allocation. When I compile it under the small memory model, every thing runs fine, until I increase the amount of allocation the program performs. Then it hits the 64K code+data limit, and malloc () fails. I tried recompiling under the compact memory model (small code, large data), but upon execution, the program behaves strangely. Specifically, when I call a varargs function, it can't recognize the arguments or the end of the argument list. My call is #define LOAD_KB 1 result = jess (LOAD_KB, "rules", 0); The code that handles the variable argument list looks like: va_start(ap); while ((args[argno] = va_arg(ap, char *)) != (char *) 0) if (argno < MAX_ARGS-1) ++argno; else error (TOO_MANY_ARGS, jess () was given too many arguments (%d)\n", argno); va_end(ap); I think the problem has to with the difference between near and far pointers (eg. the terminating zero in the call will be interpreted as a NULL pointer to char by the function jess). Could someone explain to me how one programs under memory models other than the small one? John C. Lusth Becton Dickinson Research Center RTP, NC 27709 ...!mcnc!bdrc!jcl