Turbo C => Segment size linker error

Dear All,

I am using Turbo C compiler.( 16 bit )

#include<..>
char array[ 65500 ];
main()
{
.....
}
I tried to create global character array with the size of 65500
( i.e more than 64k. )

During the program compilation,
It shows the linker error
segment _BSS exceeds 64k

why? How can i increase that array size?

Vijayakumar.M.

Comments

  • : Dear All,
    :
    : I am using Turbo C compiler.( 16 bit )
    :
    : #include<..>
    : char array[ 65500 ];
    : main()
    : {
    : .....
    : }
    : I tried to create global character array with the size of 65500
    : ( i.e more than 64k. )
    :
    : During the program compilation,
    : It shows the linker error
    : segment _BSS exceeds 64k
    :
    : why? How can i increase that array size?
    :
    : Vijayakumar.M.
    :

    I use Turbo C (v2.01) too and used Turbo Pascal. I think it is not possible to declare an object whose size is larger than 64k=65536 bytes, even globally. I do not know exactly why your array cannot be allocated then. Which memory model do you use (tiny, small, medium, large, huge)?
    With such a global declaration, you array is normally allocated in the data zone, not on the stack (whose size is determined by "_stklen" defined in dos.h).
    I tried to declare such an array (globally) and my program compiled successfully.
    If you do not manage to declare such an object, use the heap. You can create a linked list.

    Take care, Steph.
  • : I tried to create global character array with the size of 65500
    : ( i.e more than 64k. )
    :
    : During the program compilation,
    : It shows the linker error
    : segment _BSS exceeds 64k
    :
    : why? How can i increase that array size?
    :
    : Vijayakumar.M.
    :

    [blue]That's one of the main reasons Microsoft went to 32-bit compilers and operating systems so that they can take advantage of all the computer's RAM (and even more). With a 32-bit compiler you don't have to worry about that 64K-per-object limitation. See www.bloodshed.com for a free Dev-C++.[/blue]


  • : Dear All,
    :
    : I am using Turbo C compiler.( 16 bit )
    :
    : #include<..>
    : char array[ 65500 ];
    : main()
    : {
    : .....
    : }
    : I tried to create global character array with the size of 65500
    : ( i.e more than 64k. )
    :
    : During the program compilation,
    : It shows the linker error
    : segment _BSS exceeds 64k
    :
    : why? How can i increase that array size?
    :
    : Vijayakumar.M.
    :
    [blue]Use the DOS allocator to allocate an array and pointers declared as huge to access it. But that a huge 8-) hassle! Better use the DEV C++ compiler (or any other 32-bit compiler) as [b]stober[/b] said.[/blue]
  • : Dear All,
    :
    : I am using Turbo C compiler.( 16 bit )
    :
    : #include<..>
    : char array[ 65500 ];
    : main()
    : {
    : .....
    : }
    : I tried to create global character array with the size of 65500
    : ( i.e more than 64k. )
    :
    : During the program compilation,
    : It shows the linker error
    : segment _BSS exceeds 64k
    :
    : why? How can i increase that array size?
    :
    : Vijayakumar.M.
    :

    I used MSVC 1.52 to compile your code above. The default is small memory model (/AS), and it gave me the same linker error. However, when I compiled using compact (/AC) and larger memory models it compiled and linked without complaint. Does Turbo C allow for larger memory models?

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories