[comp.os.msdos.programmer] Turbo C++ and Extended Memory, Huge model, large data structs

ajai@sce.carleton.ca (Ajai Sehgal) (09/11/90)

I'm writing an application in Turbo C++ which requires large data structures,
ie an array of dimension 1,500,000 bytes (to hold a 512 x 512 image in real
format). I thought I could use farmalloc to allocate a large chunk of memory
and then use ponters to store and retrieve the data. The problem I encounter
is the lack of memory access to memory above 640K. Can Turbo C++ make use of
extended memory other than for overlay swapping? Is there a solution with
Turbo C++ ? If not How about Zortec C++, I'm in early development so if I have
to switch I will. Is Zortech better?


Regards, Ajai.

joe@proto.COM (Joe Huffman) (09/12/90)

In article <ajai.653069128@talos.sce.carleton.ca>, ajai@sce.carleton.ca 
(Ajai Sehgal) writes:
> I'm writing an application in Turbo C++ which requires large data structures,
> ie an array of dimension 1,500,000 bytes (to hold a 512 x 512 image in real

Zortech doesn't support extended memory directly.  You can program with
the Rational Systems DOS extender and Zortech C/C++ and do malloc()'s of up 
to 64 K until you run out of extended memory.  Which should do it for you.

Or you could use expanded memory and the Zortech _handle pointers.  This
will limit you to 16K per malloc() and dereferenceing a pointer is slower
(but nearly transparent to the programmer).  But you do have access to
expanded (not extended) memory without the cost of the DOS extender.

> If not How about Zortec C++, I'm in early development so if I have
> to switch I will. Is Zortech better?

Yes.  :-)

--
Zortech mailing list: send email to 'ztc-list-request@uunet' with:
Add: your-user-name@your-machine-name
In the body of the message.
--
Send Zortech bug reports to 'zortech-bugs@proto.com'
--
Zortech is my major source of income.  Statements about them or their 
competitors cannot be totally without bias.  
-- 
joe@proto.com
FAX: 208-263-8772

bright@Data-IO.COM (Walter Bright) (09/13/90)

In article <ajai.653069128@talos.sce.carleton.ca> ajai@sce.carleton.ca (Ajai Sehgal) writes:
<I'm writing an application in Turbo C++ which requires large data structures,
<ie an array of dimension 1,500,000 bytes (to hold a 512 x 512 image in real
<format). I thought I could use farmalloc to allocate a large chunk of memory
<and then use ponters to store and retrieve the data. The problem I encounter
<is the lack of memory access to memory above 640K. Can Turbo C++ make use of
<extended memory other than for overlay swapping? Is there a solution with
<Turbo C++ ? If not How about Zortec C++, I'm in early development so if I have
<to switch I will. Is Zortech better?

Zortech C++ supports the development of applications using the Rational
DOS Extender. This gives the program the capability to directly access up
to 16Mb of memory (it runs the program in 286 protected mode). You will
need to purchase the Rational DOS Extender in addition to the Zortech compiler
to do this. Call Zortech at 800-848-8408 for more info.

You still cannot declare or allocate a single object that consumes more than
64k, even in protected mode. For your application, I suggest instead
allocating 512 arrays of 512 bytes each, as in:
	char *array[512];
	for (i = 0; i < 512; i++)
		array[i] = (char *) malloc(512);

P.S. I wrote the compiler.

pnl@hpfinote.HP.COM (Peter Lim) (09/15/90)

> 
> Zortech C++ supports the development of applications using the Rational
> DOS Extender. This gives the program the capability to directly access up
> to 16Mb of memory (it runs the program in 286 protected mode). You will
> need to purchase the Rational DOS Extender in addition to the Zortech compiler
> to do this. Call Zortech at 800-848-8408 for more info.
> 
> You still cannot declare or allocate a single object that consumes more than
> 64k, even in protected mode. For your application, I suggest instead
> allocating 512 arrays of 512 bytes each, as in:
> 	char *array[512];
> 	for (i = 0; i < 512; i++)
> 		array[i] = (char *) malloc(512);
> 
How hard would it be to get the compiler to generate code that will allow
declaration of a single object > 64K ? Metaware High-C used to advertise
"Can your C-compiler do this ? ....   int data[1000000];". So, they can
do it.

I reckon it is harder when you have to be able to generate real mode normal
DOS code as well. But can you give me an idea how hard ?


> P.S. I wrote the compiler.
> ----------
>
Overall its a nice compiler. I like it.


Regards,                       ## Life is fast enough as it is ........
Peter Lim.                     ## .... DON'T PUSH IT !!          >>>-------,
                               ########################################### :
E-mail:  plim@hpsgwg.HP.COM     Snail-mail:  Hewlett Packard Singapore,    :
Tel:     (065)-279-2289                      (ICDS, ICS)                   |
Telnet:        520-2289                      1150 Depot Road,           __\@/__
  ... also at: pnl@hpfipnl.HP.COM            Singapore   0410.           SPLAT !


#include <standard_disclaimer.hpp>

joe@proto.COM (Joe Huffman) (09/22/90)

In article <34890003@hpfinote.HP.COM>, pnl@hpfinote.HP.COM (Peter Lim) writes:

> How hard would it be to get the compiler to generate code that will allow
> declaration of a single object > 64K ? Metaware High-C used to advertise
> "Can your C-compiler do this ? ....   int data[1000000];". So, they can
> do it.

I've done it with the Zortech compiler.  Of course it was running under the
Phar Lap DOS extender or UNIX at the time.  :-)

Available soon...

---
Zortech mailing list: send email to 'ztc-list-request@uunet.uu.net' with:
Add: your-user-name@your-machine-name
In the body of the message.
---
Send Zortech bug reports to 'zortech-bugs@proto.com'
---
Zortech is my major source of income.  Statements about them or their 
competitors cannot be totally without bias.  
-- 
joe@proto.com
FAX: 208-263-8772

bright@Data-IO.COM (Walter Bright) (09/22/90)

In article <34890003@hpfinote.HP.COM> pnl@hpfinote.HP.COM (Peter Lim) writes:
<How hard would it be to get the compiler to generate code that will allow
<declaration of a single object < 64K ? Metaware High-C used to advertise
<"Can your C-compiler do this ? ....   int data[1000000];". So, they can
<do it.

Shortly we (Zortech) will have a 386 compiler which can generate full 32
bit apps to run under dos using PharLap's DOS Extender. Then it will be
practical and trivial to manipulate objects >64k in size.