Aug 95 Top 10
Volume Number: | | 11
|
Issue Number: | | 8
|
Column Tag: | | Symantec Top 10
|
Symantec Top 10
This monthly column, written by Symantecs Technical Support Engineers, aims to provide you with technical information based on the use of Symantec products.
By Glenn L. Austin and Levi Brown
Note: Source code files accompanying article are located on MacTech CD-ROM or source code disks.
Q: When I save the position of hidden windows in TCL, they always end up at the top-left of the screen rather than where they were actually located. Whats happening?
A: CWindow::FrameToGlobalR() currently assumes that the window is visible when it is called. Therefore, you need to insert the following lines into CWindow::FrameToGlobalR() above the line which starts off with:
offset = topLeft((**((WindowPeek
and insert this code:
if (!visible)
{
CView* oldPView = cPreparedView;
Prepare();
offset.v = offset.h = 0;
LocalToGlobal(&offset);
if (oldPView)
oldPView->Prepare();
}
else
Q: Why does the amount of free memory go down every time I bring up a window which contains a CArrayPane?
A: There is a problem with CArray::GetFrom. Just before the line which reads:
hItems = NewHandleCanFail(elementSize);
insert the line:
TCLForgetHandle(hItems);
Q: When Im building static libraries, I keep getting the error:
PPCLink encountered an error
# Error: Non-shared libraries do not support "-main main"
# Error: (3015) While writing
PowerMac:Development:staticlib:staticlib1.o
# Error:
# Fatal error:
PPCLink - Execution terminated!
from Symantec C++ 8.0. What does this mean?
A: Go to the Options menu, select Linker, select the -main main in PPCLink settings, and delete it.
Q: While debugging some optimized code using the THINK Debugger, Im watching two of my variables in the Data window, and both of those variables are changing to the same value when one of the variables is changed. Why is that?
A: When you produce optimized code, the compiler will use a register for one variable, then reuse it for a different variable within the same function if it can do so safely. The debugger associates the two variables with the same register, and you see the variables values coincide.
Q: After updating to TCL 2.0.6, my applications now have a link error CTableBorder:: not defined. Why?
A: CTableBorder was added in TCL 2.0.6, but the source file CTableBorder.cp hasnt been added to your project. Add the CTableBorder.cp file in the Table Classes folder to the Table segment of your project.
Q: The active border for a CTable doesnt get drawn in 2.0.6. Why?
A: The table has already become the gopher by the time the border would be drawn. Change CTable::BecomeGopher() from:
if (fBecoming)
{
if (gGopher != this)
to:
if (fBecoming)
{
if (gGopher == this)
Q: Im having problems with strcat in Symantec C++ 8.0 trashing memory. Whats wrong?
A: There is a problem in strcat when the second string is an empty string. There are three options to dealing with this string:
(1) Use the C version of str.c rather than str.asm.
(2) explicitly test for an empty string, ie.
if (*t)
strcat(s, t);
or
(3) download the script to fix the bug in str.a from ftp.symantec.com. The script is located in:
ftp://ftp.symantec.com/public/devtool/mac/updaters/
sym.cpp-va-tcl.updates/str.c.update.hqx
Q: I get an undefined identifier __nan when I include complex.h in my .cp files and bring my project up to date. What is wrong?
A: Go to the Think Project Managers Edit menu, select Options and choose the Symantec C++ sub-option. Choose Language Settings in the popup menu and uncheck the ANSI Conformance checkbox. Also, be sure to add the Complex library from the Standard Libraries to your project.
Q: Ive got a 68K program which uses floating point. How do I convert it to run on the PowerMac?
A: The basic solution is to use fp.h rather than math.h or SANE.h. fp.h will automatically include the proper header for the 68K or PPC compiler, SANE.h or PowerPCfp.h.
Q: Im having problems accessing devtools.symantec.com. Why?
A: In order to consolidate our services, all of our files have been moved to ftp://ftp.symantec.com/public/devtool/mac, as well as our WWW service at http://www.symantec.com
Special thanks to Mark Baldwin, Craig Conner, Rick Hartmann, Michael Hopkins, Steve Howard, Noah Lieberman, Andy McFarland, Scott Morison, and Kevin Quah.