Archive for the ‘Delphi 2006’ Category
Posted by jpluimers on 2012/09/14
Two days ago I ran into the bug below while porting some code from Delphi 2006 to Delphi XE2, posted on StackOverflow, and got solutions in very little time.
Thanks Andreas Hausladen, David Heffernan, Ken White, Sertac Akyuz, Rudy Velthuis, for answering, providing solutions and verifying!
Note that this worked up until Delphi XE, and has been fixed in Delphi XE3 (which for this project I can’t use as the client upgraded to XE2 without SA).
Problem
- I get the error mentioned further on error when debugging an executable in Delphi XE2 update 4 under these circumstances:
- that depends on mqic.dll from WebShpere that is in C:\Program Files \IBM\WebSphere MQ\bin\mqic.dll and C:\Program Files\IBM\WebSphere MQ\bin is on the system path (not on the user path).
- is being debugged with an override environment variable in the Run -> Parameters -> Debugger -> Environment Block -> User overrides
- Including System Variables on the same property page is checked
This is the error (it’s a Windows DLL load error marked “System Error”).
The program can’t start because mqic.dll is missing from your computer. Try reinstalling the program to fix this problem.
Solutions
–jeroen
via delphi – while debugging with Environment Variable “The program can’t start because ….dll is missing” – Stack Overflow.
Posted in Delphi, Delphi 2006, Delphi 2007, Delphi XE, Delphi XE2, Delphi XE3, Development, Software Development | Tagged: ibm websphere mq, software, stack overflow, technology | Leave a Comment »
Posted by jpluimers on 2012/09/11
Today I found out the hard way that you really need a build integration system for managing VersionInfo in Delphi applications: as of Delphi XE2 it is broken in the IDE.
See these links:
This is the only workable workaround so far:
–jeroen
Posted in Delphi, Delphi 2005, Delphi 2006, Delphi 2007, Delphi 2009, Delphi 2010, Delphi 5, Delphi 6, Delphi 7, Delphi XE, Delphi XE2, Delphi XE3, Development, Software Development | Tagged: application version, computer, Delphi, delphi applications, education, embarcadero, integration system, stack overflow, technology | 14 Comments »
Posted by jpluimers on 2010/05/11
This Why does this code fail in D2010, but not D7 question on stackoverflow once again shows that SizeOf on character arrays usualy is evil.
My point in this posting is that you should always try to write code that is semantically correct.
By writing semantically correct code, you have a much better chance of surviving a major change like a Unicode port.
The code below is semantically wrong: it worked in Delphi 7 by accident, not by design:
Like many Windows API functions, GetTempPath expects the first parameter (called nBufferLength) number of characters, not the number of bytes. Read the rest of this entry »
Posted in Delphi, Delphi 2005, Delphi 2006, Delphi 2007, Delphi 2009, Delphi 2010, Delphi 3, Delphi 4, Delphi 5, Delphi 6, Delphi 7, Delphi XE, Delphi XE2, Delphi XE3, Development, Encoding, ISO-8859, Software Development, Unicode | Leave a Comment »
Posted by jpluimers on 2009/10/19
Operator overloading is a very nice feature of the Delphi language.
However. the Delphi documentation on Operator overloading is not completely right.
Below is my table of what I found out so far, and some notes.
It is part of my “Nullable types in Delphi” session that I gave on some conferences.
The downloads for that session contain more detailed information.
This is just an abstract to get you going and a try to answer this operator overloading question on Stackoverflow.
Download the full presentation to get more in depth information.
Let me know if you need more information.
Notes
Operator overloading
Add your own “behaviour” to operators
- Win32: Works only for records, not classes!
- An operator and the operand(s)
are being implemented worden by a “class operator”;
this is a kind of class method with name and argumen(s)
Example:
- Multiplication X : = A * B;
- Operator: *
- Name: Multiply
- Operands: 2 -> two parameters
type
TMyRecord = record
class operator Multiply(A, B: TMyRecord): TMyRecord;
end;
Documentation is not correct!
Combining the rules of operator and result types, you can do magical things like Dances with XML | Australian Delphi User Group Members.
Do not use Delphi 2006 with operator overloading
Delphi 2007 fixed a number of bugs including this one: Delphi 2006 wont allow const parameters of type record within record method? – Stack Overflow.
10+ years later: maybe assignment operator?
It might be that in 2019, a new Delphi version gets assignment operator overloading: [WayBack] Operator Overloading Explained – Code Partners
Watch the result type of comparison operators!
Tips:
- Some operators should be overloaded pair-wise
= and <>
shl and shr
< and >=
> and <=
dec and inc
+ and –
/ and *
div and mod
- Prefer Explicit over Implicit operators
- Beware of the built-in type coercion (implicit operators)
- e.g
- Byte to Integer;
- Integer to Double;
- Variants from/to anything!
Table of operators
| operator |
# |
usage |
name |
cagetory |
* |
| and |
2 |
R := A and B; |
BitwiseAnd |
bit |
|
| not |
1 |
R := not A; |
//BitwiseNot |
bit |
glitch: does not exist! |
| or |
2 |
R := A or B; |
BitwiseOr |
bit |
|
| xor |
2 |
R := A xor B; |
BitwiseXor |
bit |
|
| () cast |
1 |
R := TValue(A); |
Explicit |
conversion |
|
| := |
1 |
R := A; |
Implicit |
conversion |
|
| operator |
# |
usage |
name |
category |
* |
| round |
1 |
R := Round(A); |
Round |
function |
|
| trunc |
1 |
R := Trunc(A); |
Trunc |
function |
|
| and |
2 |
R := A and B; |
LogicalAnd |
logical |
|
| not |
1 |
R := not A; |
LogicalNot |
logical |
|
| or |
2 |
R := A or B; |
LogicalOr |
logical |
|
| xor |
2 |
R := A xor B; |
LogicalXor |
logical |
|
| operator |
# |
usage |
name |
category |
* |
| + |
2 |
R := A + B; |
Add |
binary |
|
| / |
2 |
R := A / B; |
Divide |
binary |
|
| div |
2 |
R := A div B; |
IntDivide |
binary |
|
| mod |
2 |
R := A mod B; |
Modulus |
binary |
|
| * |
2 |
R := A * B; |
Multiply |
binary |
|
| – |
2 |
R := A – B; |
Subtract |
binary |
|
| operator |
# |
usage |
name |
category |
* |
| shl |
2 |
R := A shl B; |
LeftShift |
binary |
name is confusing |
| shr |
2 |
R := A shr B; |
RightShift |
binary |
name is confusing |
| – |
1 |
R := -A; |
Negative |
binary |
|
| + |
1 |
R := +A; |
Positive |
binary |
|
| dec |
1 |
Dec(A); |
Dec |
self |
|
| inc |
1 |
Inc(A); |
Inc |
self |
|
| operator |
# |
usage |
name |
category |
* |
| = |
2 |
R := A = B; |
Equal |
comparison |
|
| > |
2 |
R := A > B; |
GreaterThan |
comparison |
|
| >= |
2 |
R := A >= B; |
GreaterThanOrEqual |
comparison |
|
| < |
2 |
R := A < B; |
LessThan |
comparison |
|
| <= |
2 |
R := A <= B; |
LessThanOrEqual |
comparison |
|
| <> |
2 |
R := A <> B; |
NotEqual |
comparison |
|
| operator |
# |
usage |
name |
category |
* |
| in |
2 |
R := A in B; |
In |
set |
|
–jeroen
Posted in Conferences, Delphi, Delphi 2006, Delphi 2007, Delphi 2009, Delphi 2010, Delphi XE, Delphi XE2, Delphi XE3, Development, Event, Software Development | 6 Comments »
Posted by jpluimers on 2009/10/15
Edit 20140822 since originally posting, JEDI moved to a GIT repository, so I changed some URLs and added that it is up to date until Delphi XE7.
Finding the correct VERxxx conditional define for a particular Delphi version is asked by a lot of people.
Even the first link in the above search, does not contain the full list!
But: JCL comes to the rescue
The JCL file JEDI.INC usually (read: like 99.999% of the time) is up to that with that information soon.
Currently, it contains all the defines starting with Delphi 1, up to Delphi 2010 XE7.
You can always browse the to JEDI.INC with this link to the sourceforge trunk. link to the GitHub master version.
In fact that file contains a lot more useful defines.
Actually, having the JCL and/or JVCL at hand is a very good practice: it is filled with high quality code that solves a lot of everyday problems.
Note:
VER190 (by some people attributed to the wrong Delphi version) is only used by Delphi 2007 for .NET (Delphi 2007 for Win32 used VER185 by itself and shares VER180 with Delphi 2006 for Win32).
The number 13 (in between Delphi 2009 aka Delphi 12, and Delphi 2010 aka Delphi 14) was never used as a Delphi version number
Since Delphi is mainly developed in the USA, and since a lot people there have Triskaidekaphobia, they showed mercy to those and skipped Delphi 13.
–jeroen
Posted in Delphi, Delphi 1, Delphi 2, Delphi 2005, Delphi 2006, Delphi 2007, Delphi 2009, Delphi 2010, Delphi 3, Delphi 4, Delphi 5, Delphi 6, Delphi 7, Delphi 8, Delphi x64, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Development, Software Development | 9 Comments »