Cheuk Cheng
unread,Jul 15, 1993, 11:23:03 AM7/15/93You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to
I have compiled a small Windows program under the medium memory model with
VC++ and it runs fine. Then I compile the same program using the large
memory model and then it crashes when I run it. After looking at the map
file, I found that it crashes on one line that uses strlen(). So I
replace it with lstrlen() and then it runs fine again. I am wondering why
the compiler gives me no warnings or such. Then I go ahead and read a
little in the chapter of memory management of Petzold's book and I get the
idea that in the large memory model, all code and data pointers are far
pointers. Why is that the data segment of my program changes to a
different one when the line using strlen() is called? Are there any
general guidelines about using the FAR and NEAR keywords? Microsoft's
OLE2 sample apps. use the default medium memory model of VC++ but also
contain a lot of FAR and NEAR in them while Petzold warned against using
them in his book. Does Petzold's warning apply to protected mode programs
(since my 2nd edition of the book also talks about memory management
concerning programs running under the real mode in Windows)? One last
question, will a program compiled under the large memory model be able to
run in multiple instances and if not, why not? I get really confused by
all the above.