converting delphi 2007 code to delphi XE2 -- emptyparam problem

Hi, I am trying to convert my applicantion code from delphi 2007 to delphi XE2 and i got stuck in this error "[DCC Error] ADODB_TLB.pas(4888): E2033 Types of actual and formal var parameters must be identical". This happens when we use emptyparam as an argument in a function that wants an olevariant.
Example:

function TAcadDatabase.CopyObjects(Objects: OleVariant): OleVariant;
begin
  Result := DefaultInterface.CopyObjects(Objects, EmptyParam, EmptyParam);  //this is where we get the ERROR
end;

The coyobjects function as this signature: "    function CopyObjects(Objects: OleVariant; Owner: OleVariant; var IdPairs: OleVariant): OleVariant; safecall;  "

This sample of code is from a unit that was imported (to *.pas) from a autocad library in delphi 2007. I tryied to import that same library in delphi XE2 and get lots of erros so i decided do use the .pas that i've obtained importing in delphi 2007. But don't work :-(

Help please...

thank you
0
Lara
2/8/2012 2:12:44 PM
embarcadero.delphi.general 4258 articles. 0 followers. Follow

4 Replies
2245 Views

Similar Articles

[PageSpeed] 18

Hi,

Did you try to include Variants in that unit? "uses Variants" 
I had similar problem converting outlook source. Before you
didn't have to do "uses Variants" in the unit when using EmptyParam.

Greets.
0
Robert
2/8/2012 2:43:57 PM
Hi, thank you for your help. I had already included the Variants in that unit and the error persisted.
The only way we found out to solve the problem was to use a local variable of olevariant type, then assigned that variable with EmptyParam and use it to call the function. The examples is below.

function TAcadDocument.CopyObjects(Objects: OleVariant; Owner: OleVariant): OleVariant;
*var*
  *argumento: olevariant;*
begin
  *argumento := EmptyParam;*
  Result := DefaultInterface.CopyObjects(Objects, Owner, argumento);
end;

thank you.

Problem solved! :-)




> {quote:title=Robert Triest wrote:}{quote}
> Hi,
> 
> Did you try to include Variants in that unit? "uses Variants" 
> I had similar problem converting outlook source. Before you
> didn't have to do "uses Variants" in the unit when using EmptyParam.
> 
> Greets.
0
Lara
2/8/2012 3:03:35 PM
Hello Lara,

> Hi, I am trying to convert my applicantion code from delphi 2007
> to delphi XE2 and i got stuck in this error "[DCC Error]
> ADODB_TLB.pas(4888): E2033 Types of actual and formal var
> parameters must be identical".

In earlier versions, EmptyParam was defined as a global OleVariant variable 
in both the Variants.pas and OleCtrls.pas units.  In XE2, EmptyParam is now 
defined in both units as a function that returns an OleVariant value.  The 
last parameter of the COM object's function is a 'var' parameter, so it requires 
a real variable to be passed to it.  That is why your D2007 code worked (you 
were passing a variable where a reference to a variable is expected) and 
why you have to add a local variable in your XE2 code (you cannot pass EmptyParam()'s 
result directly to a 'var' parameter).

The RTL source in XE2 does have an EMPTYPARAM_VAR define to go back to the 
old behavior, but I imagine that means you would have to recompile the RTL 
to enable it.

--
Remy Lebeau (TeamB)
0
Remy
2/8/2012 5:39:37 PM
> In earlier versions, EmptyParam was defined as a global OleVariant variable 
> in both the Variants.pas and OleCtrls.pas units.  In XE2, EmptyParam is now 
> defined in both units as a function that returns an OleVariant value.  The 
> last parameter of the COM object's function is a 'var' parameter, so it requires 
> a real variable to be passed to it.  That is why your D2007 code worked (you 
> were passing a variable where a reference to a variable is expected) and 
> why you have to add a local variable in your XE2 code (you cannot pass EmptyParam()'s 
> result directly to a 'var' parameter).

Why would they change something so significant?
How it this better when earlier code that passes EmptyParam by reference, now has to be fixed?

Edited by: Frederic Bell on Feb 18, 2012 9:47 PM

Edited by: Frederic Bell on Feb 18, 2012 9:49 PM
0
Frederic
2/19/2012 5:49:39 AM
Reply:

Similar Artilces:

converting delphi code to delphi .NET
Hi,I'm looking at converting quite a bit of old delphi code to delphi .NET .  I'm wondering can it be converted to VB.NET for certain ?  Or perhaps there are some unsupported functions etc in delphi and I should keep the code delphi ?  There are about 10,000 lines of code.   Anyone brave enough to take an estimate on how long it would take to convert 10,000 lines ?is going from delphi to delphi.NET smooth ?   Would going to another language cause complications ?Thanks! mike123   Mike123,   Sorry I can not help, however, I have the s...

Code Porting
Hi people, Basically, I am moving an app from Delphi 5 to Delphi 2009 which is all great (yeah right!) and I am having a couple of issues with some thirdparty components that we have the source code for. Being that I wanted to make the task as easy as possible, I was able to download the component in Delphi 2007 format. I have now managed to port that to 2009 so it compiles only with warnings and no errors. So all is good at this moment. Now I am trying to install the component into the IDE by using the install menu option from the project manager. This is where I run into errors. ...

Delphi 2007 to Delphi XE2 paint order change
Hello all, I have a program here that does some very specific work in the paint handlers and requires that the controls are painted from bottom to top. This worked just fine under Delphi 2007 but now that we have migrated to Delphi XE2, it no longer works. Tracing the paint order, we discovered that there are cases when the bottom most component (the form for instance) is drawn last instead of first, which means that the painting code we do in the program gets a black area for the bottom most control instead of its background. This was observed with D2007 and DXE2 on the same c...

Delphi 7.0 code convert to delphi XE ...
Hello All, I create an application using Web Server Application then CGI stand alone... In WebModule I add ModuleController component and IWPageProcedure... Below is my code in Delphi 7.0, this is how to call another units in webmodule... .... .... procedure TWebModule1.proMainGetForm(ASender: TIWPageProducer; AWebApplication: TIWApplication; var VForm: TIWPageForm); begin VForm := TfrmMain.Create(AWebApplication); end; procedure TWebModule1.proLogInGetForm(ASender: TIWPageProducer; AWebApplication: TIWApplication; var VForm: TIWPageForm); begin VForm := TfrmLogIn.Create(AWebA...

Delphi 2010
*Upgrading from Delphi 2007 to Delphi 2010* (as of February 1, 2010) I bought a new computer in December and decided to upgrade from Delphi 2007 to Delphi 2010. Here are some lessons learned related to the Delphi upgrade, which I hope will make a similar transition easier for others. I still have an insurmountable problem with the speed of the IDE (#13 below). As background, my old system had 3 GB of RAM, 40GB of unused disk, a 3.8 GHz CPU, and ran under Windows XP. My new system has 12 GB of RAM, 770GB of unused disk, a quad core 2.67 GHz CPU, and runs under Win7 Home Edition. ...

Delphi 7 to Delphi XE2
Hi, Still using that old workhorse, Delphi7, but am going to the conference in London hosted by Embarcadero on Delphi XE2. Although I would like to "move with the times" and am keen to get the UNICODE and 64-bit support offered by the latest IDEs, I confess to being more than a little scared about all the UNICODE/String/AnsiString and 32/64 bit issues I'm probably going to fall over. Anyone recently upgraded from Delphi7 to one of the latest Delphi IDEs? Thanks, Alain On 03/02/2012 08:55, Alain Dekker wrote: > Still using that old workhorse, Delphi7, but...

Delphi 2007 to Delphi 7
I've written a class in Delphi 2007 that is not supported in Delphi 7. What would be the best way to achive what I've done in Delphi 2007 in Delphi 7? Thanks, Tom type BondConstants = class { Bond Types } type BondType = record const TREASURY = 3; AGENCY = 0; CORP = 1; MUNI = 2; SBA = 5; MBS = 4; CMO = 6; end; { Day Count Methods } type DayCount = record const ACTUAL_360 = 2; ACTUAL_365 = 1; ACTUAL_ACTUAL = 1; d30_360 = 0; ...

Delphi 4 to Delphi 2007
Hello, I will have to port a D4 application (with source) to D2007. what kind of problem could I face ? I will have to go to customer site tommorow to analyse its source code to quote the work, what should I care of to hestimate the porting time ? Thanks John Terry wrote: > Hello, > I will have to port a D4 application (with source) to D2007. > what kind of problem could I face ? > I will have to go to customer site tommorow to analyse its source code > to quote the work, what should I care of to hestimate the porting time ? You can probably do it by just changi...

SEPA components for Delphi with Source Code (Delphi 5
Hi all, in the european union change next year the Bankingformat to the SEPA Format. All peoples and companies must change the bankingssoftware and the costumer data form acountnummers in the new IBAN and BIC numbers. See: http://www.arma-it.de/shop/artikelueber.php?wgruppeid=211&wgruppe_offen=211 Functions: - generate SEPA XML'S - Calc IBAN - BIC Database (DE,AT and CH) Questions: vertrieb@arma-it.de PS: Bankinssoftware for Develpoers (Germany only) http://www.arma-it.de/shop/artikelueber.php?wgruppeid=212&wgruppe_offen=212 El 26/10/13 21:38, A...

Convert Delphi 5 ADO App to Delphi 2007 ADO.NET
I have an appliction tha that is writen in Delphi 5 with ADOConnetion, ADOTable, and ADOQuery components. I need to upgrade to Delphi 2007 and use ADO.NET. I have the program building in with Delphi 2007. Is there anything I need to do to convert the ADO to ADO.NET? > I need to upgrade to Delphi 2007 and use ADO.NET. Why ? -- With best regards, Dmitry Arefiev AnyDAC (www.anydac.com) - Oracle, MS SQL Server, IBM DB2, MySQL, Firebird, Interbase, PostgreSQL, Sybase ASA, SQLite, MS Access, DBX, ODBC, InMem - universal high-speed native data access engine Reasons for ...

Best Place to get help on converting Delphi 2007 string to Delphi 2009
Where is the best place to get help on converting Delphi 2007 strings to Delphi 2009? The most common problem getting Delphi 7-Delphi 2007 components to compile seems to be caused by the new Unicode strings in Delphi 2009. It would be great if there was some place to go to get help with this. Maybe there should be a new group for String conversion where developers could ask short questions about conversion. For example: Delphi 7 - Delphi 2007 CharArrayPtr = ^CharArray; CharArray = array[0..MaxInt-1] of Char; Compiles Delphi 2009 CharArrayPtr = ^CharArray; CharArray ...

Delphi and Delphi for .Net
It seems that Delphi for .Net is slower than Delphi Win32 native applicaiton. I would like to know is it true all .Net application is slower than Win32 native applicaiton or it is Delphi for .Net only. Your information is great appreciated, Inung On 2011-06-21 18:20:17 +0100, Inung Huang said: > It seems that Delphi for .Net is slower than Delphi Win32 native applicaiton. > I would like to know is it true all .Net application is slower than > Win32 native applicaiton or it is Delphi for .Net only. If you are only running the code in the application once then, yes, yo...

Delphi 2007 to Delphi 2009 Conversion
CharArrayPtr = ^CharArray; CharArray = array[0..MaxInt-1] of Char; How to convert to Delphi 2009? Bill Bill Miller wrote: > CharArrayPtr = ^CharArray; > CharArray = array[0..MaxInt-1] of Char; > > How to convert to Delphi 2009? > > Bill it depends heavelly on how it is used fearther down in your project and what you want to convert it to. I you want to simple convert the declarations ignoring UNicode altogether then the only think you have to change is the CharArray declaratin from a Char to an AnsiChar eg CharArrayPtr = ^CharArray; CharArray =...

Delphi 2009 alongside Delphi 2007
Hi all, I am about to install Delphi 2009 on the same development system as Delphi 2007, before I embark is there anything I should be aware of so as to not break my Delphi 2007 installation and projects ? Thanks JT John Taylor wrote: > Hi all, > > I am about to install Delphi 2009 on the same development system > as Delphi 2007, before I embark is there anything I should be aware > of so as to not break my Delphi 2007 installation and projects ? As long as you install into a separate folder there is no problem with the two versions getting into each other...

Migrate from Delphi 2007 to Delphi 2010
Hi All, Thanks in advance for your help. Below is my query, Currently I am using Delphi 2007 and i want to migrate to Delphi 2010. 1. What all things i need to take care while doing this? 2. What all third party components will get impacted? 3. Any known issues in Delphi 2010 which might impact the cause? 4. Any changes in database operation required as i am using Oracle? Hope I have post this query under correct category. If not sorry for the trouble and could you please suggest me the correct category for this? Looking forward for your response. Have a great day. Th...

Web resources about - converting delphi 2007 code to delphi XE2 -- emptyparam problem - embarcadero.delphi.general

PastBook’s Filepicker.io Integration Eases Process Of Converting Facebook Content To Books
PastBook , one of several companies that allow Facebook users to publish their content on the social network in actual books , announced the ...

Facebook No Longer Converting Groups Into Pages
Back when Facebook first launched Facebook Pages, many businesses and brands who had built up substantial audiences in their Facebook Groups ...

Zwartz Laminating-Converting B.V. on the App Store on iTunes
Get Zwartz Laminating-Converting B.V. on the App Store. See screenshots and ratings, and read customer reviews.


"Occupier" Thanked Former Soviet Citizen for "Converting" Him to Capitalism, Pro-Israel, Pro-USA - YouTube ...
May Day Demonstration on Union Square in New York City Zionism & Birth of Modern Israel in 1948: Former Soviet Citizen Pays Tribute to Ben-Gurion ...

Converting dry air to water: solution to Broken Hill's water crisis gains support
A one-man crusade by a Broken Hill resident to solve the historic town's water crisis by introducing air to water converters is gaining support. ...

Click go fears of converting print files
Is there a way to convert a print queue item to a .RTF or .PDF file? I like to save or email them. - The Sydney Morning Herald

Sudanese woman ordered to hang under sharia law for converting to Christianity gives birth
Khartoum, Sudan: A Christian Sudanese woman sentenced to hang for apostasy has given birth in jail, a Western diplomat said on Tuesday.

Imams warn against radicalism to Aboriginal inmates converting to Islam
The prison system has enlisted the help of ASIO to crack down on radicalisation behind bars amid revelations that Aboriginals are converting ...

Converting the world's companies one by one - The Science Show - ABC Radio National (Australian Broadcasting ...
Image: Trucks carrying logs make their way up a road in Jambi, Indonesia. A vast area of the Sumatran forest, and orangutan habitat, is being ...

Resources last updated: 2/5/2016 4:53:19 AM