Malloc Trouble with Large Memory Model
Brendan J. McMahon
bjm at sabin.UUCP
Thu Apr 20 05:42:35 AEST 1989
We have never had any need for any memory module other than the
default small.
We are switching to a new machine (intel 386 ) and our database libraries
(informix) only came in the large model.
So all programs that use these have to be compiled with -Ml2 (large model 286).
(Or do they?)
Jist of a Problem:
struct labelrec{
int blah;
.
.
};
struct labelrec *lrec[20];
lrec[0]=(struct labelrec *)malloc(sizeof(struct labelrec));
Compile Message:
Warning: cast of int expression to far pointer
Run time problems:
Printf(sizeof(struct labelrec)) = Some huge number
It should be around 64.
So it looks like it has put the lrec pointers into a seperate data segment,
but the int return value from malloc does not give lrec[0] the
large full address (segment:offset pair) needed to access this data.
I am not familiar with memory modules, so many attempts to throw in
near/far keywords around different definitions did no good.
Thanks for any help!
--
Brendan J. McMahon
Sabin Metal Corp. | Refiners of Precious Metals | Hardware Trouble?
Scottsville, NY | ****** Au Ag Pt Pd Rh ****** | Give us a call, we'll
716-538-2194 |lazlo!sabin!bjm || ritcsh!sabin!bjm| melt your trouble away
More information about the Comp.lang.c
mailing list