Re-compile SysUtils.pas in Delphi 7

i hope to change the Exception.Create() function in SysUtils.pas to become:

constructor Exception.Create(const Msg: string);
begin
  FMessage := 'happy testing';
end;

however, how to re-compile it to generate a new SysUtils.dcu in my Borland\Delphi7\Lib folder ?

i tried to open a project that uses SysUtils and choose to click "Build All Projects", however, a new SysUtils.dcu is still not generated.

any idea ?
chongkeng_woonAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

jpedefCommented:
Copy SysUtils.pas to your project directory (or to some directory in your search path).
Modify and save it.
Compile your project without runtime packages.
Should use modified SysUtils now.
0
chongkeng_woonAuthor Commented:
How to compile my project without runtime packages?

i try to copy the SysUtils.pas to my project directory and rename it to SysUtils1.pas ..

yes, it is now reading the SysUtils1.pas now, however, when i run the program, it said
"Exception Exception in module Project1.exe at 000991D2"

any idea ?
0
2266180Commented:
hm.. why not do something like this:

unit myexception;

interface

uses sysutils;

type Exception = class(SysUtils.Exception)
         constructor Create(const Msg: string);
       end;

implementation

constructor Exception.Create(const Msg: string);
begin
  inherited;
  FMessage := 'happy testing';
end;

end.

then in you project files just put as a last unit, the one from above. It willa utomatically use the exception class defined by you without you even modifying any code. howeverm other exception.create statements that are not made explicitly by you will not be changed (for example an exception thrown from another component. But you can always catch all exceptions and just wrapped them up in your custom one.

just a small idea on how to do something similar to what you want without recompiling anything. It is usually a better aproach not to recompile stuff. If not for other reasons, then for the one that you can't pass the sources to someone else without asking them to make your changes in their units as well.

cheers
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

jpedefCommented:
Don't rename it just save it with same name.
Disable runtime packages from delphi menu (Project -> Options -> Packages tab and make sure Build with runtime packages is unchecked).

Ciulys method is better if you don't need any more changes to SysUtils and you only want custom exceptions to be used by your code. But why not then leave SysUtils untouched and add 'happy testing' as Msg param.

Backround
Delphi doesn't compile source files in Delphi\Source directory unless they aren't moved to somewhere else. Thats because those directories aren't in search path.
0
chongkeng_woonAuthor Commented:
it seems like ciuly suggestion is working....however, i have another problem ...

in normal circumstances, after calling the Exception.Create() function, a message dialog box will pop up and display "happy testing" message. If i click OK button now, all functions will exit.

is there anyway or how to modify my SysUitils.pas to disable this message dialog box coming out (but still exit all the functions) in Exception.Create() function?

because my client doesn't want to see any message dialog box coming out, they just want to see a log file for those error message (in this case error message is "happy testing") ..

thanks
0
2266180Commented:
that only happens during debug in the IDE, right? just run the app from outside the ide and you won't get those dialogs. OR, you can disable exception stopping on delphi exceptions.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.