[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Re-compile SysUtils.pas in Delphi 7

Posted on 2006-04-24
8
Medium Priority
?
1,498 Views
Last Modified: 2012-06-27
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 ?
0
Comment
Question by:chongkeng_woon
  • 2
  • 2
  • 2
6 Comments
 
LVL 3

Expert Comment

by:jpedef
ID: 16523525
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
 

Author Comment

by:chongkeng_woon
ID: 16523621
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
 
LVL 28

Accepted Solution

by:
2266180 earned 252 total points
ID: 16529407
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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 3

Assisted Solution

by:jpedef
jpedef earned 248 total points
ID: 16531693
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
 

Author Comment

by:chongkeng_woon
ID: 16532226
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
 
LVL 28

Expert Comment

by:2266180
ID: 16533029
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

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Suggested Courses

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question