C++ Builder 2010 How to switch to FASTMM - c++builder

I have some projects which were done in c++ builder 2009 and they need borlandmm.dll to run. I have read that c++ Builder 2010 by default use Fastmm, but it doesn't seems to be the case in my projects. They still need borlandmm.dll
So how can I switch my projects to use Fastmm ?

Try to create empty project - it should not require borlandmm.dll.
You've probably used some unit, which requires borlandmm.dll.

Related

Where did the unit named InvRules (formerly in the SOAP folder) go in Delphi XE2?

I am trying to port some Delphi XE code to XE2, it uses a unit called InvRules.pas, which according to the XE2 docs, has no namespace prefix.
It also isn't in the soap folder where I expect it:
C:\Program Files (x86)\Embarcadero\RAD Studio\9.0\source\soap
The simplest answer is that it's been removed (accidentally or on purpose) from XE2.
Has anyone figured out what's up? This unit contains functions like GetStackTypeSize, and RetOnStack, which are used sometimes in custom TRIOHelper type classes.
This unit is no longer used by the soap runtime so it's not being shipped anymore. In previous releases, it was part of the soaprtl runtime package. There were some significant changes made to the soap runtime for the XE2 release to make the code portable to x64 and less reliant on BASM code that was essentially duplicated in the RTTI support units. The change log entry associated with the commit states:
Refactor out InvRules, use RTTI to get type sizes.
Remove InvRules, PrivateHeap from soap package.
If you have code which relies on the helper routines in this unit you should be fine using the source from a previous release. You may also want to diff the Invoker.pas, InvokeRegistry.pas, OPToSOAPDomConv.pas and Rio.pas units between XE and XE2 to see how the code changed so it no longer relies on the InvRules.pas unit.

Is it possible to debug a C++builder dll from Delphi if I have the dll sourcecode?

I have an application written in Delphi 7 which uses a c++ dll written in BCB 5.
I want to debug this dll from the Delphi IDE is this possible?
If it's possible which are the steps to debug?
As additional information I have the full source code of the dll.
It has been a while since I have dealt with C++ / Delphi together. But if I remember correctly, you can use the BCB IDE to run the Delphi application (compiled already) that uses your DLL. Basically, in your project settings in BCB, you can set a program to run when you click the "run" button, and I believe that you will be able to set breakpoints and stuff that will be caught when functions of your DLL are being called by that application. Still, this implies that you have BCB.
My recollection, and it's been a while since I last tried this, is that you need the C++ Builder IDE to do this.
It should be possible:
I have done it quite often to debug a BCB5 dll within the Delphi 6 IDE. My delphi 6 application uses the DLL and I can then step from the delphi code into the bcb code (and back). So I might work with Delphi 7 too.
Delphi isn't configured by default to do that. At that time I found an explanation on the web how to do it. Not sure, but it might have been the following page: http://www.delphifaq.com/faq/delphi/delphi_ide/f178.shtml
You will also need to compile the dll in debug mode and to indicate the path to the source code of the dll in the project options of your delphi application.

Can Delphi 2007 IDE use Delphi 2010's cgrc.exe while compile RC files?

The CGRC.exe in Delphi 2010 support using dot as resource name. I wish to use it in Delphi 2007 IDE as well. Is that possible to do so?
In Delphi 2007 IDE, when we compile a project that has .RC file, the build message will show something like:
BRCC Command Line
-w32 -foC:\Users\coder\Project\account.core.res -iC:\Users\coder\Project\developer -dDEBUG C:\Users\coder\Project\account.core.rc
However, it doesn't really use BRCC32.EXE to compile the RC files as I rename the
C:\Program Files (x86)\CodeGear\RAD Studio\5.0\bin\brcc32.exe
to something else.
Delphi 2007 evidently doesn't give you an option of what to run. If it already gave you an option to directly run RC, then it would provide you no benefit to use CGRC instead. The documentation tells you that CGRC does nothing but translate the BRCC command-line syntax into the syntax that Microsoft's RC requires, and then it runs RC.
The utility is probably provided so that the IDE only needs one command-line-generating subroutine instead of two or more. With this utility, the IDE can generate a single set of command-line options, so it only has to vary the EXE file it invokes based on the project options.
It seems that you were hinting at the possibility of replacing the brcc32.exe file that Delphi 2007 provides with the cgrc.exe file Delphi 2010 provides. But Delphi doesn't actually run brcc32.exe, apparently. That suggests that the actual resource-compilation ability is in a DLL that's shared by both brcc32.exe and the IDE or the code compiler. You don't want to go down the path of replacing DLLs.
So I guess the answer to your question is no. You'll have to find some other way of achieving whatever it is you're try to do.
In Delphi 2007 the only way I found is to run RC.EXE or in a pre-build script or in a build tool script (I use CCNet).

How do I Import TypeLib as safecall vs stdcall in Delphi 2010

Delphi versions before 2010 had an option in the Delphi Environment that one could set: "All v-table interfaces". This would change the calling convention when importing type libraries. In 2010, the option is gone. How do I import a type library with the safecall calling convention? I'm hoping maybe there is a more granular level of control in 2010 than previous versions, but regardless - how do I do this now?
Thanks.
I haven't tried using the "All v-table interfaces" option in the Delphi 2010 IDE. It was definitely broken in D2009.
You can use the command-line tlibimp tool to create the _tlb.pas files you need:
tlibimp -P -Pt <tlb file>
If you look at the resulting .ridl file that is generated, you will see that the methods have _stdcall defined.
You have a finer level of control using the .ridl files now.

In Delphi 7, can I set up 'Debug' and 'Release' modes?

In most modern IDEs, you can have Debug and Release build configurations, and you can quickly switch between them.
In Delphi 7, this does not seem to be possible. I have to go to Project Settings and toggle optimization and all the debug information stuff manually.
It would be great if there was a plugin or some such that handled this for me.
Does anyone know of one? Any other suggestions?
Edit: I can't upgrade to Delphi 2007 or 2009 as we have a large Delphi 7 codebase which would have to be converted. I agree that would be the best solution in theory though :P
You can very easily add project configurations, similar to what other IDEs offer, using Andreas Hausladen's great DDevExtensions IDE expert. Just make sure to download the 1.6 version from the link I mentioned, since later versions only work with Delphi 2009. The 1.6 version works with any Delphi version between 5 and 2007, inclusive.
The expert adds a submenu under the Project menu, in case you can't find it at first.
I don't know of any build-configurations plugin for Delphi 7, but you could however simulate this;
Just apply an include-file in every unit of your project(s) (which is a smart thing to do anyways) and let it adjust itself to one single define, like this :
--- ExampleIncludeFile.inc ---
{$IFDEF DEBBUG}
{$OPTIMIZATION OFF}
{$RANGECHECKING ON}
// etc
{$ELSE}
{$OPTIMIZATION ON}
{$RANGECHECKING OFF}
{$ENDIF}
Now, if you add DEBUG to the Compiler defines in your .dof project settings, you'll get a Debug-build, and if you remove it, you get a release build. Other setups are entirely possible too ofcourse.
Delphi 2005 does have Build Configurations embedded in the Project Manager (Release and Debug only), and Delphi 2009 add even more to this, with nice little things like 'Option sets' and custom 'Configurations' (that you could even mark as Default for all new projects). Give it a look, it's a really great product!
Not directly in Delphi 7, but you have options:
Wrap the compiler directives for all the changes (debug, optimization, etc.) inside a user defined compiler directive, and then set a compiler directive to change between debug and release.
Additionally you can use FinalBuilder or other similar build tools to create builds that use different settings.
Delphi 2005 has this functionality added. So upgrade to Delphi 2007 or 2009 and get it built in. They are both very stable versions with a lot of new features.
This feature was added only in Delphi 2009.
For older versions of Delphi you can write two copies of .cfg file, one with debug options and one with release options, and compile your program calling dcc32.exe from within a batch file.
Something like this:
rem release.bat
copy release.cfg myprog.cfg
dcc32 -B myprog.dpr
rem debug.bat
copy debug.cfg myprog.cfg
dcc32 -B myprog.dpr

Resources