Willy
Willy

Reputation: 1838

Failed to recompile the source code of indy10 on XE2

Following the question, I am trying to modify the source code of Indy10 (IdHTTPProxyServer.pas). But failed to recompile the indy10 project... My IDE is XE2, and following are the steps I did..

  1. Remove package "Indy 10 Core Design Time" and "Indy 10 Protocols Design Time" in Menu->Component->Install Packages

  2. Open IndyProtocols.dpk

  3. Make changes in IdHTTPProxyServer.pas

  4. Compile

And then sometimes it shows error "Access violation in rtl160.bpl", sometimes it shows error "Exception xxx(any component) in coreide160.bpl at XXXXXX"

As I am not really familiar with the develop environment, I totally do not understand what is wrong ... Any help will be appreciated.

Thanks


Thanks for all replies. All your suggestions make me realize the develop environment more. Finally I accept the answer of @Marcus Adams as there are more than one developers in the project. It is better not to change the source files of the IDE.

Upvotes: 1

Views: 878

Answers (4)

mjn
mjn

Reputation: 36654

You can skip the component / package compilation steps and simply create the Indy components at run time.

Add the Indy Lib Core/Protocols/System paths to the project search path and you are done.

Upvotes: 1

Kenneth Cochran
Kenneth Cochran

Reputation: 12084

Neither of the errors you mentioned are compiler errors. Its unlikely they are caused by the compiler itself. They are probably coming from somewhere else in the call chain leading up to the compile.

A short term solution would be to compile from the command line. MSBuild is the build engine Delphi uses under the hood.

  1. Edit whatever Indy files in the IDE as you normally would, save your changes then close the IDE.
  2. Open the Rad Studio Command Prompt from the start menu. This will make sure the proper environment variables are set to run the command line build. You could also use the standard command prompt and run rsvars.bat to accomplish the same thing.
  3. Use cd to change directories to the location of IndyProtocols.dpk
  4. Type msbuild IndyProtocols.dpk /target:Build /p:config=Release

If you want to do a debug version just change /p:config=Release to /p:config=Debug. Note that case is important when working with msbuild because the project files are xml, which is case sensitive.

Also, for what its worth you should try to avoid making changes directly to the libraries shipped with the IDE. If you found a bug in a supplied library that you need fixed for a specific project you can usually get by with copying the offending file into your project's folder and making your changes to it there. You'll also likely need to copy several other dependent files as well. If you take this approach the compiler will inform you which dependents need to be copied with errors such as Unit * was compiled with a different version of *.*


Now if you really want to debug the IDE you can try but the rtl and coreide packages used throughout the IDE and are both compiled as release versions (no debugging info) so it may be difficult to determine what's causing the errors you're seeing.

Anyways, you can run a second instance of the IDE with the IndyProtocols.dpk loaded in the project manager. Then use Run > Attach to Process from the first IDE instance to attach the debugger to the second IDE instance. After that just try building IndyProtocols.dpk from the second IDE instance. If all goes as expected the debugger will catch the errors and let you break at where they occurred so you can dig around.

Upvotes: 1

Marcus Adams
Marcus Adams

Reputation: 53850

Normally, when I change source code, I save the modified source file to my project folder. That way, just that unit gets recompiled.

If you changed a particular .pas file, just save it to your project folder and recompile. Leave the original Delphi (and Indy) source files untouched.

This also makes it easier to update in the future, since your changes don't get lost after an update, and your changes don't affect other projects.

Upvotes: 3

Sean B. Durkin
Sean B. Durkin

Reputation: 12729

There are a couple of VCL design-time packages (to do with DataSnap) that link to the bundled version of Indy. If you are going to update your indy, you need to do the following things:

  1. Find those packages (I cant remember them of the top of my head, but I will get back to you on that), and remove them from the installed packages list.
  2. Remove the bundled Indy packages from the installed packages list.
  3. Rename the bundled Indy dcu directory, so the IDE doesn't get confused about which instance of Indy dcu to use.
  4. Rename the bundled Indy bpl files, so the IDE doesnt load the wrong one.

Only then should you compile your new version of Indy.

Upvotes: 1

Related Questions