Board index » cppbuilder » Variant

Variant


2008-02-08 02:59:39 AM
cppbuilder109
Why why why
when I use a Variant variable and tray to compile in "Release Build"
get this: "[Linker Fatal Error] Fatal: Access violation. Link terminated."
when compile in "Debug" mode is OK why why why ??? ??? ??? ??? ???
 
 

Re:Variant

What version of BDS are you using?
Did you recently upgrade your compiler?
"DPJ" < XXXX@XXXXX.COM >wrote in message
Quote
Why why why
when I use a Variant variable and tray to compile in "Release Build"
get this: "[Linker Fatal Error] Fatal: Access violation. Link
terminated."

when compile in "Debug" mode is OK why why why ??? ??? ??? ??? ???





 

Re:Variant

DPJ wrote:
Quote
when I use a Variant variable and [try] to compile in "Release Build"
get this: "[Linker Fatal Error] Fatal: Access violation. Link
terminated."

when compile in "Debug" mode is OK why why why ???
Can you reproduce tthis bug in the small test application? Probably
it's subject for QC ...
--
Alex
 

{smallsort}

Re:Variant

sorry the massage is "Project bleble.exe raised exception class EOleErorr
with message 'Variant does not reference an automation object'."
compiler is upgraded.
sample for AlexB
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bool __fastcall CreateADO(String kwer, String DBname)
{
bool rezult = false;
int varNull = ADORecord.Type();
if(varNull != 3 && varNull != 0)
{
int i = ADORecord.Exec(Function("State"));
if(i != adStateClosed)
ADORecord.Exec(Function("Close"));
ADORecord.Clear();
//free (ADORecord);
}
WideString ConectString = ShemaConectString(DBname);
try
{
ADORecord = Variant::CreateObject("ADODB.Recordset");
}
catch(EOleSysError &err)
{
MessageBox(NULL, "Could not create Recordset object",
err.Message.c_str(),MB_OK);
return rezult;
}
ADORecord.Exec(PropertySet("CacheSize") << 30);
ADORecord.Exec(PropertySet("Source") << kwer);
ADORecord.Exec(PropertySet("ActiveConnection") << ConectString);
ADORecord.Exec(PropertySet("CursorType") << adOpenKeyset);
ADORecord.Exec(PropertySet("LockType") << adLockOptimistic);
try
{
ADORecord.Exec(Function("Open"));
rezult = true;
}
catch(EOleSysError &err)
{
return rezult;
}
return rezult;
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bool __fastcall ReadList_RecepturyGrupy(TStringList *sL)
{
bool rezult;
AnsiString Text;
AnsiString colName;
Variant Field;
Variant Value;
Variant Fields = ADORecord.Exec(PropertyGet("Fields"));
Variant count = Fields.Exec(PropertyGet("Count")); //
ile pól ma rekord;
Variant RC = ADORecord.Exec(Function("RecordCount")); // ile
rekordów
int recordCount = RC;
try
{
for(int k = 0; k < recordCount; ++k)
{
for(int i = 0; i < count; ++i)
{
Field = Fields.Exec(Function("Item") << i);
colName = (AnsiString)Field.Exec(PropertyGet("Name"));
Value = Field.Exec(PropertyGet("Value"));
if(Value.IsNull() == false)
{
if(i != 0)
Text = (String)Value;
else
Text = " " + IntToStr(k +1);
}
if(Text.IsEmpty() == false)
sL->Add(Text);
Text = "";
}
Variant Field = ADORecord.Exec(Function("MoveNext"));
}
}
__finally
{
rezult = true;
return rezult;
}
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Użytkownik "Larry Griffiths" < XXXX@XXXXX.COM >napisa?w wiadomości
Quote
What version of BDS are you using?

Did you recently upgrade your compiler?


"DPJ" < XXXX@XXXXX.COM >wrote in message
news: XXXX@XXXXX.COM ...
>Why why why
>when I use a Variant variable and tray to compile in "Release Build"
>get this: "[Linker Fatal Error] Fatal: Access violation. Link
>terminated."
>
>when compile in "Debug" mode is OK why why why ??? ??? ??? ??? ???
>
>
>
>
>


 

Re:Variant

DPJ wrote:
Quote
sorry the massage is "Project bleble.exe raised exception class
EOleErorr with message 'Variant does not reference an automation
object'." compiler is upgraded.
In initial message you wrote:
when I use a Variant variable and try to compile in "Release Build"
get this: "[Linker Fatal Error] Fatal: Access violation. Link
terminated."
When compile in "Debug" mode is OK
If this error can be reproduced in small demo then it's good subject
for QC report.
Now you write about runtime error...
Is there Debug/Release difference ?
Where you get error ?
Quote
sample for AlexB
I can't examine your DB code (no enough skill).
Quote
bool __fastcall ReadList_RecepturyGrupy <...>
...
__finally
{
rezult = true;
return rezult;
}
NEVER perform 'return' within 'finally' block because of bugs in binary
code generation.
--
Alex
 

Re:Variant

AlexB wrote:
In addition to the often fatal error Alex pointed out with _finally,
wanted to throw out a caution in what looks like unclear code:
bool __fastcall ReadList_RecepturyGrupy(TStringList *sL)
{
Variant Field;
try
{
for(int k = 0; k < recordCount; ++k)
{ for(int i = 0; i < count; ++i)
{
Field = Fields.Exec(Function("Item") << i);
}
Variant Field = ADORecord.Exec(Function("MoveNext"));
}
}
You have TWO Field variables.
Probably not what you intended.
 

Re:Variant

"AlexB" < XXXX@XXXXX.COM >wrote:
Quote
NEVER perform 'return' within 'finally' block because of bugs in binary
code generation.
Out of curiosity, is the following supposed to have any defined result
(bugs excluded):
int f()
{
try {
return 1;
} __finally {
return 2;
}
}
Alan Bellingham
--
Team Browns
ACCU Conference 2008: 2-5 April 2008 - Oxford, UK
 

Re:Variant

Quote
>Can you reproduce this bug in the small test application?
why not, it is small but I do't want to show all source public
Użytkownik "AlexB" < XXXX@XXXXX.COM >napisa?w wiadomości
Quote
DPJ wrote:

>when I use a Variant variable and [try] to compile in "Release Build"
>get this: "[Linker Fatal Error] Fatal: Access violation. Link
>terminated."
>
>when compile in "Debug" mode is OK why why why ???

Can you reproduce tthis bug in the small test application? Probably
it's subject for QC ...

--
Alex
 

Re:Variant

"DPJ" < XXXX@XXXXX.COM >writes:
Quote
>>Can you reproduce this bug in the small test application?
why not, it is small but I do't want to show all source public
If you reduce the code to just the bug, then almost nothing will be
revealed in your source code that is application-specific. You can
rename variables to x, y and z too, if that helps. Remove
*everything* that is not absolutely essential to reproduce the
problem.
Usually a bug can be condensed into a representative program in 10-20
lines of "generic" code, sometimes as many as 50 lines. Over that,
unless the bug is specifically related to large programs somehow
exceeding internal compiler limits, the problem is probably not
sufficiently reduced to be a concentrated example.
It's difficult to give away company secrets in such a scenario, and
espeically safe when it's known that the code does not work. Perhaps
it actually be a competative *advantage* to post buggy code with the
hope that your competition finds it and incorporates it into their
codebase! :)
--
Chris (TeamB);
 

Re:Variant

"Chris Uzdavinis (TeamB)" < XXXX@XXXXX.COM >wrote in message
Quote
Perhaps
it actually be a competative *advantage* to post buggy code with the
hope that your competition finds it and incorporates it into their
codebase! :)
LOL... you just gave me all sorts of great ideas...