home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.os.msdos.programmer
- Path: sparky!uunet!mcsun!sunic!dkuug!daimi!aau!psykseth
- From: psykseth@aau.dk (Seth Chaiklin)
- Subject: structures >64K
- Message-ID: <1993Jan8.135612.14930@aau.dk>
- Summary: How do you make a structure over 64K?
- Keywords: struct, huge
- Organization: Aarhus University, Denmark
- Date: Fri, 8 Jan 1993 13:56:12 GMT
- Lines: 72
-
- I am having problems making a 'huge' struct. As some of you may
- remember from last month, I was asking about how to make arrays
- over 64K. Well now I am trying (rather unsuccessfully) to
- achieve the following:
-
- (a) initialize a structure that is about 80K
- (b) have that structure be global.
-
- The structure itself is not very complicated:
-
- struct yynew {
- int current;
- int advance;
- };
-
- and the initialization is just small integers
-
- yycrank[] = {1,2,3,4,0,175,0,1,175...};
-
-
- And it all works just fine as stated, provided the initialization is under
- 64K. But I want to use about 40,000 integers in initializing this
- structure, and that is where my problem begins.
-
- I cannot figure out how to declare yycrank to be a 'huge' structure in
- Turbo C 2.0.
-
- I can't seem to be able to declare yynew to be huge.
-
- For example:
-
- typedef struct huge yynew {
- int current;
- int advance;
- } YYNEW;
-
- gives a "structure or union syntax error "
-
- And if I try something like:
-
- YYNEW huge yycrank; /* conflicting type modifiers - fair enough */
-
- huge YYNEW yycrank; /* syntax error */
-
- Ok -- so I get the idea (by implication) from the Turbo C manual that
- I have to use a pointer to get a big structure. So I try something like this:
-
- YYNEW *yycrank;
- yycrank = (YYNEW huge *) farmalloc(20000L * sizeof(YYNEW));
-
- Well that will compile if it is placed inside of a function (though the
- compiler (rightfully) complains about a suspicious pointer conversion.
-
- But if I try to compile this globally then I get these errors
-
- Declaration needs type or storage class
- Type mismatch in redeclaration of 'yycrank'
- Illegal initialization
-
- plus the warning:
-
- Suspicious pointer conversion
-
-
- Aaarrrggghhh! Given that it is possible to do all this if I am working
- under 64K. Then I would assume that there must be a way to allocate
- memory for a structure that is over 64K. But my various trials and
- errors have been discouragingly unsuccessful. Advice appreciated.
-
- Cheers,
- Seth
- psykseth@aau.dk
-