Главная страница | назад

Article #17349: Converting Delphi and BCB1.0 Components for use with BCB3.0

 Question and Answer Database

FAQ2349C.txt   Converting Delphi and BCB1.0 Components for use with BCB3.0
Category   :VCL
Platform    :All
Product    :C++Builder  3.x

How do I convert a Delphi or C++Builder1.0 component to work
with C++Builder 3.0?

Converting C++Builder1.0 components to C++Builder3.0:

1) Missing PACKAGE modifier on the class:

class PACKAGE TGenericComponent : public TComponent

2) Missing PACKAGE modifier on the Register function:

void fastcall PACKAGE Register() 

3) Missing #pragma package (smart_init) in the CPP source just
below the include section.

4) Invalid ValidCtrCheck declaration. Components created for
C++Builder1.0 looked like this:

static inline TGenericComponent *ValidCtrCheck()

Components created for C++Builder3.0 must have the line modified to look like this:

static inline void ValidCtrCheck(TGenericComponent *)

5) Another modification made to components from C++Builder1.0
is that the line in the ValidCtrCheck function that looks like

return new TGenericComponent(NULL);

should look like this:

new TGenericComponent(NULL);

NOTE: Options 4 and 5 are only if there are only needed if there
are more than one component per CPP file.

Converting Delphi components to BCB3:

1) Add the following line of code just after the uses section:

{$ObjExportAll On}

7/2/98 10:32:32 AM

Last Modified: 01-SEP-99