? array too big in dos ok in unix 
Author Message
 ? array too big in dos ok in unix

hi,

 the below code compiles under unix ,however, the dos compiler borland 3.1 or
turbo 2.0 complain that the array is too big. how can i fix this problem so as
this code could be used on either software platform.

#include <stdio.h>
void main(void)
{
typedef struct
  {
    long msl;
    long lsl;
  } Key_Table_Type;
Key_Table_Type      Key_Table[18000];

...........
...........
...........

Quote:
}

any and all helped will be greatly appreciated




Tue, 11 Jan 2000 03:00:00 GMT  
 ? array too big in dos ok in unix

Try using a 32 bit DOS compiler such as the port of GNU CC to DOS.

Under NORMAL limited dos 64k is the max size (of just about any single
object).  If you stay with LIMITED DOS then you must make sure that you
do NOT EXCEED this limit.

Under NORMAL limited DOS a long is 4 bytes long, your structure is
therefore 8 bytes long, making your table a little over 140k!  You could
break this up into four seperate tables.

In any case, the easiest solution would be to use ANY 32 bit DOS compiler
where these limits no longer apply.  WATCOM is CHEAP --- GNU is FREE!!

--
Best regards,
 _ __                      _    ,   _ _ _
' )  )     /         _/_  ' )  /   ' ) ) )
 /--' ____/___/> __  /     /--/     / / / __,_  __  o _   ______
/  \_(_) /_) (__/ (_<__   /  ( o   / ' (_(_) (_/ (_<_/_)_(_) / <_


Software Developer                      Tel:    +49 721 9628 167
Hitex-Systementwicklung GmbH            FAX:    +49 721 9628 261



Quote:
> hi,

>  the below code compiles under unix ,however, the dos compiler borland
3.1 or
> turbo 2.0 complain that the array is too big. how can i fix this problem
so as
> this code could be used on either software platform.

> #include <stdio.h>
> void main(void)
> {
> typedef struct
>   {
>     long msl;
>     long lsl;
>   } Key_Table_Type;
> Key_Table_Type      Key_Table[18000];

> ...........
> ...........
> ...........

> }

> any and all helped will be greatly appreciated





Mon, 17 Jan 2000 03:00:00 GMT  
 ? array too big in dos ok in unix

Compile for Large/Huge memory model which treats memory as a flat.  Well....
Not exactly flat, but segments become so large in size that you might as
well treat them as flat.  Using a different memory model is one of the
compiler options.  You may wnat to make sure that correct libraries are
installed for the model you select.

Ed-


Quote:
>hi,

> the below code compiles under unix ,however, the dos compiler borland 3.1
or
>turbo 2.0 complain that the array is too big. how can i fix this problem so
as
>this code could be used on either software platform.

>#include <stdio.h>
>void main(void)
>{
>typedef struct
>  {
>    long msl;
>    long lsl;
>  } Key_Table_Type;
>Key_Table_Type      Key_Table[18000];

>...........
>...........
>...........

>}

>any and all helped will be greatly appreciated





Tue, 18 Jan 2000 03:00:00 GMT  
 ? array too big in dos ok in unix



Quote:

>Compile for Large/Huge memory model which treats memory as a flat.  Well....
>Not exactly flat, but segments become so large in size that you might as
>well treat them as flat.

The memory models that 16 bit compilers DOS/Windows use don't change the
segment size at all, in all cases it is 64K. A large memory model allows
different objects to be in different segments so that overall you
can address more than 64K data but each individual object is limited to
less than 64K. Huge memory model tries to stitch segments together to
allow objects greater than 64K (but not always with 100% success). For
more information see comp.os.msdos.programmer.

--
-----------------------------------------


-----------------------------------------



Thu, 20 Jan 2000 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Big DOS Arrays with farmalloc() (Repost)

2. Big DOS Arrays with farmalloc() ?

3. Help: Large 3-d Arrays, work in unix, not in dos

4. Help: Large 3-d Arrays, work in unix, not in dos

5. Big Arrays arrays using B

6. Big Arrays arrays using Borland Turbo C...

7. Help...Is the array to big

8. Newbie question: Making arrays bigger

9. Big arrays

10. PLEASE HELP ME ON BIG ARRAY IN BORLAND C

11. Array size to big

12. How to allocate big array???

 

 
Powered by phpBB® Forum Software