Board index » cppbuilder » maybe a big BUG in C++Builder6

maybe a big BUG in C++Builder6


2003-10-06 04:43:54 PM
cppbuilder93
hi,
I think I found a BUG in C++ Builder6. try following steps.
1. use Dll wizard creat a dll project named "test.dll"
2. use __declspec(dllexport) to export an function, for example "SetupDll"
3. in the body of SetupDll, reference an exported object in VCL60.bpl, such
as Forms::Screen, for example
void SetupDll(void)
{
Screen->MonitorCount;
}
4. Create a new project named "testprj"
5. add test.lib to project testprj
6. add code "SetupDll();" to a function, force testprj.exe link with
"test.dll";
7. new a frame "Frame1", put a page control "PageControl1" in it, and new a
tab sheet "TabSheet1" in "PageControl1";
8. put a button "Button1" in the main form of testprj;
9. write the OnClick function of Button1 as following:
void __fastcall TForm1::Button1Click(TObject * Sender)
{
TFrame1 *f1 = new TFrame1(this);
f1->Parent = this;
f1->Visible = true;
}
10. Build test.dll and testprj.exe
11. Run testprj.exe, there is a window with a button named "button1", click
the button, you will get an
exception EInvalidOperation, message is "Frame1 has no parent window".
I had tested for a long time, following is some phenonmenion:
a. if test.dll or testprj.exe is not built with option "Package|build with
runtime package", no exception thrown.
b. if frame is not created dynamically, no exception thrown,
c. if no tab sheet control in frame, no exception thrown
d. if no object in VCL60.bpl was referenced in test.dll, no exception
thrown.
According to those evidents, I think this is a BUG in c++builder 6.0
 
 

Re:maybe a big BUG in C++Builder6

Please add it to qualityc central at qc.borland.com - it will be seen by
Borland there.
Rgds Pete
"xiao zhen" < XXXX@XXXXX.COM >wrote in message
hi,
I think I found a BUG in C++ Builder6. try following steps.
1. use Dll wizard creat a dll project named "test.dll"
2. use __declspec(dllexport) to export an function, for example "SetupDll"
3. in the body of SetupDll, reference an exported object in VCL60.bpl, such
as Forms::Screen, for example
void SetupDll(void)
<snip>
 

Re:maybe a big BUG in C++Builder6

Both your Exe and Dll must be built with run time package on. Otherwise there
are two sets of RTTI for the VCL objects and you will have problems.
xiao zhen wrote:
Quote

hi,

--
Jeff Overcash (TeamB)
(Please do not email me directly unless asked. Thank You)
If there is somebody up there could they throw me down a line. Just a
little helping hand just a little understanding. Just some answers to the
questions that surround me now. If there's somebody up there could
they throw me down a line. (Fish)
 

{smallsort}

Re:maybe a big BUG in C++Builder6

"Jeff Overcash (TeamB)" < XXXX@XXXXX.COM >wrote:
certainly! in fact, the BUG appears only when EXE and DLL are both built with runtime package on. if not so, no problem appears.
Quote
Both your Exe and Dll must be built with run time package on. Otherwise there
are two sets of RTTI for the VCL objects and you will have problems.