Board index » cppbuilder » try-catch in a package

try-catch in a package


2004-04-22 06:00:43 AM
cppbuilder47
Not sure if this is the correct ng. I'm creating a new package & if I
put in a try-catch, it won't compile. It gets a linker error:
[Linker Error] Export __fastcall System::TObject::ClassName() in module
D:\PROJECTS\NOVAWIND\VERSION2\TICKPACK\PRTTICKET.OBJ references
__fastcall System::TObject::ClassName(System::TMetaClass *) in unit
C:\PROGRAM FILES\BORLAND\CBUILDER5\LIB\RELEASE\VCL50.BPI|System
If I take out the try-catch, it compiles & runs OK. Why doesn't the
try-catch work in packages?
Don
 
 

Re:try-catch in a package

They do work. You need to provide more information.
Sorry, I don't know the answer to the problem.
--
Malcolm Smith
MJ Freelancing
www.mjfreelancing.com
"Don Locke" < XXXX@XXXXX.COM >wrote in message
Quote
Not sure if this is the correct ng. I'm creating a new package & if I
put in a try-catch, it won't compile. It gets a linker error:

[Linker Error] Export __fastcall System::TObject::ClassName() in module
D:\PROJECTS\NOVAWIND\VERSION2\TICKPACK\PRTTICKET.OBJ references
__fastcall System::TObject::ClassName(System::TMetaClass *) in unit
C:\PROGRAM FILES\BORLAND\CBUILDER5\LIB\RELEASE\VCL50.BPI|System

If I take out the try-catch, it compiles & runs OK. Why doesn't the
try-catch work in packages?
Don
 

Re:try-catch in a package

Thanks for the information. I have an app that is now 2.6M so I'm
moving some of the code to a package. These forms work OK when in the
large app. But when I put them into a package, I the package won't
compile until I remove the try-catch. After you informed me that they
do work, I created a small package with a new form. It compiled OK so I
then put in a try-catch & it still compiled. So it looks like something
is wrong with my package. I'll keep looking.
Don
 

{smallsort}

Re:try-catch in a package

I have found that packages don't like this code:
try
{
...
}
catch(Exception &E)
{
String msg = "Problem with printing ticket\n\n";
msg += E.ClassName();
msg += +": ";
msg += E.Message;
Application->MessageBox(msg.c_str(), "ERROR", MB_OK);
}
But if you remove the line:
msg += E.ClassName();
It compiles correctly. Why does the code not compile with that line?
Don
Don Locke wrote:
Quote
Thanks for the information. I have an app that is now 2.6M so I'm
moving some of the code to a package. These forms work OK when in the
large app. But when I put them into a package, I the package won't
compile until I remove the try-catch. After you informed me that they
do work, I created a small package with a new form. It compiled OK so I
then put in a try-catch & it still compiled. So it looks like something
is wrong with my package. I'll keep looking.
Don
 

Re:try-catch in a package

Well, the line before has an extra '+' before the string so that might be it
(or a typo in the email)
Rgds Pete
"Don Locke" < XXXX@XXXXX.COM >wrote in message
Quote
I have found that packages don't like this code:

try
{
...
}
catch(Exception &E)
{
String msg = "Problem with printing ticket\n\n";
msg += E.ClassName();
msg += +": ";
msg += E.Message;
Application->MessageBox(msg.c_str(), "ERROR", MB_OK);
}

But if you remove the line:

msg += E.ClassName();

It compiles correctly. Why does the code not compile with that line?