C++ Builder, linker error on adding ApplyUpdates() call

PColbert

Member²
TOracleSession's ApplyUpdates() can be called, but apparently not linked. Here's how to reproduce the problem. Take the DOA DeptGrid demo, compile it, and run it. Everything's okay. Now add a line
if(0)MainSession->ApplyUpdates(0,0,false);
to any member function of TMainForm. You will be able to compile, but not link. The same problem occurs with CommitUpdates() and CancelUpdates().

Problem observed with C++ Builder 5 with the first patch, and DOA 3.4.3. I also have C++ builder 3, and will try it with that.

I suspect that it's a problem with the declaration of ApplyUpdates() in file Oracle.hpp. ApplyUpdates() does appear in the library file, but perhaps it has a different parameter list. The C++ compiler adds the parameter types to the function name (this is how function overloading is accomplished), so if the parameter lists don't match, this linker error is exactly what you'd expect.

Suggestions on how to fix it would be appreciated.
 
Originally posted by PColbert:
I suspect that it's a problem with the declaration of ApplyUpdates() in file Oracle.hpp. ApplyUpdates() does appear in the library file, but perhaps it has a different parameter list.

This proved correct. Using TDUMP to examine both Oracle.obj and Main.obj, I found that the functions' first parameter, DataSets, is not declared quite right. In the Oracle.hpp it is
Db::TDataSet * const * DataSets
while in Oracle.obj it is declared
const Db::TDataSet * * DataSets
This applies to all three functions: ApplyUpdates, CancelUpdates, and CommitUpdates.

Correcting the .hpp file allowed the demo program to link and run.

If this problem appears with C++ Builder 3, I'll know how to fix it.
 
This is a known C++Builder 5 bug (it will work fine in C++Builder 3 and 4), though we previously found a different work around . Yours is better though, because now we can fix it in the distributed include files. Thanks for reporting this.

------------------
Marco Kalter
Allround Automations
 
Back
Top