Incorrect Class Transtype at the LogOn

Laurent

Member
Hi,

In a treatment in a program developed with Delphi 2009, I have the following error (in French) :

Exception d
 
Hello,

I have the same problem of my collegue Laurent.

Here are more information about the environnement of the error message :
I'm using a Delphi DLL which return an object "TDLLObj" containing TOracleQuery and TOracleDataSet components.
In the Delphi program using this DLL, I call a Create function which return an instance of "TDLLObj".
"TDLLObj" has an initialization procedure which need in parameter a TOracleSession (which is in the Delphi program).

This initialization function assign this TOracleSession to the session of TOracleQuery and TOracleDataSet components in "TDLLObj".

When I reconnect the TOracleSession in Delphi program, I have this error in french :
"Transtypage de classe incorrect" => "Invalid class cast"

The call stack shows the exception in : TOracleQuery.SetDefaultVariableCharSets -> TVariables.Data

The problem semms to be that, when the TOracleSession is disconnected and then connected, a DOA procedure assigns all TOracleQuery and TOracleDataSet linked to this session. But in this case, this reassignment can not work properly when TOracleQuery and TOracleDataSet are in a DLL.

------------------------------------
Init function in DLL :

function TDLLObj.Init(oraSession: TOracleSession);
begin
oraQuery.Session := oraSession;
oraDataSet.Session := oraSession;
end;

------------------------------------
Delphi program :
// Oracle connexion
mySession.Connected := false;
mySession.Connected := true;

// Loading DLL and creating DLLObj object
...
myDLL := CreateDLLObj();
...
myDLL.Init(mySession);
...
//Invoke some function in the DLL
myDLL.Function1();

// Reconnect Oracle Session
mySession.Connected := false;
mySession.Connected := true; => error message

DOA version : 4.1.1.0
Delphi 2009 (CodeGear
 
I've have try to use ShareMem instead of SimpleShareMem, same result and error message.

It means that TOracleSession cannot be pass throught a DLL ?

Another idea to resolve this bug ?

Thanks in advance
--
Hugues
 
I would like to know if you have found a solution about this specific problem because it becomes urgent to found a solution in order to continue my development.

Thanks

--
Hugues
 
Hi Marco,

I've try the last DOA version : 4.1.2 and the same error still appears.

I would be gratefull if you could resolve this error very shortly and give me a resolution date.

Keep me inform of the advancement of the solution, thanks

--
Hugues
 
Hi Marco,

It would be nice if you could tell me if you are looking at my problem and if a solution could be found very quickly because I must deliver my development at the end of september...

--
Hugues
 
Hi !

This problem is very critical...and we are a few having this bug here...

Do you have any solution ? It's been a very long time now...and still no news...

Without any feedback, I think I will search other solutions sooner or later, and leave DOA...
I'm a DOA customer since 2002...I would be grateful if you could find a solution to this explicit and clear problem...

Thanks.
 
Hi,

any news about this problem ?
it's very important to solve it shortly.

Could you tell me if a solution will be found and when ?

thanks for your answer.

--
Zugg
 
Hi Marco,

thanks for you reply.

It is to possible to send me your test application (DLL program and the program using this DLL sending an OracleSession) in order to compare it with my complete program.

Could you tell me with wich Oracle version, Delphi, DOA you have done your test ?

--
Zugg
 
Hi Marco, any news ?

It seems that error is due to session reconnection:
1- OracleSession.Connected := true;
2- loading DLL and pass OracleSession in parameter in order to share the session between my application and my dll
3- close OracleSession in my application: OracleSession.Connected := false; my DLL is always load in memory
4- reconnection: OracleSession.Connected := true; => error appears

In my DLL I have a datamodule wich contains TOracleQuery and TOracleDataSet and when I load the DLL, I link TOracleQuery/TOracleDataSet with my OracleSession application.
When I delete this link, error will not always appear.

How can I share TOracleSession with an application and a DLL ?

 
Last edited:
Thanks for this demo, I'll take a look to see how it works and compare it with my dll code.
 
Last edited:
Back
Top