Jump to content

C++ Custom Component (Ver 1500 trial, cbuilder 10.2.3)


akr

Recommended Posts

Hi,

I am trying to write a unigui custom component. For testing I derived a simple component from TUniEdit.

It compiles and gets installed.

As soon as I put it on a unigui form I get a access violation in rtl250.bpl in function "GetPropList". Qdp7Wap.png

 

Doing the same in Delphi Pascal works fine. Has this ever worked? Any change to get it fixed? We are evaluating unigui for a large C++ application.

 

Link to comment
Share on other sites

Hi, I have a package (bpl), no exe. Exe seems to work. I need to convert existing c++ components from vcl to unigui first.

How to statically link a bpl? Can u provide a example please?

Link to comment
Share on other sites

  • Administrators

I am referring to

 

Quote

 

Additional steps for C++ Builder

 

After starting a new C++ project, you must disable Linker->Dynamic RTL.

New C++ projects are created without a resource (.RES) file. As a result, the project has no default Icon. This issue will be fixed in next releases.

Combo VCL/ISAPI projects are not supported for C++ Builder.

It is recommended to build your C++ Builder app without Run-Time Packages. You must statically link all libraries and create a single EXE. You can also use the default mode which uses run-time packages by default. If you want to build your application in this mode, then please read section Run-time Packages & C++ Builder.

 

 

Please see below docs:

http://www.unigui.com/doc/online_help/installation_instructions.htm

http://www.unigui.com/doc/online_help/runtime-packages--c-builder.htm

Link to comment
Share on other sites

Thank you. But still not working.

My test exe is linked statically - > working

My bpl can only be linked dynamically -> not working. Still crashing at the same function stated above. Some missing RTTI afaik.

This is my current linker commandline (important part):

  C:\Users\Public\Documents\Embarcadero\Studio\19.0\DCP -lC:\Users\Public\Documents\Embarcadero\Studio\19.0\DCP -r -v -Gi -Gn -aa -s -V5.0 
  -GBCustomComp -Tpp  c0pkg32 dbrtl.bpi rtl.bpi uIndy25.bpi uniGUI25.bpi uniGUI25Chart.bpi uniGUI25Core.bpi uniTools25.bpi vcl.bpi vcldb.bpi memmgr.lib 
  sysinit.obj .\Win32\Debug\CustomComp.obj .\Win32\Debug\UniDateTimePicker1.obj , C:\Users\Public\Documents\Embarcadero\Studio\19.0\BPL\CustomComp.bpl 
  , C:\Users\Public\Documents\Embarcadero\Studio\19.0\BPL\CustomComp.map , import32.lib cp32mt.lib , , CustomComp.res 

Can u please make:

1) A Package project in C++

2) Add a component, derived from e.g. TUniEdit. 

3) Compile, install and drag it on a form.

Is it crashing? Please advise.

Link to comment
Share on other sites

Looks like C++ does not work with unigui. Giving up now. This is too bad because the new C++ compilers are clang based and produce a highly optimized code. Much better than all existing delphi compilers.

I cant understand this. While Pascal is a good programming language C++ opens the doors to other projects in the world. This community should be more open minded to programming languages which are state of the art nowadays.

Link to comment
Share on other sites

It looks like the problem can be reproduced with static linked executables. The following crashes with unigui while it works with vcl without problems. I debugged pulling the source module from vcl into my project. Its crashing in GetPropList due to problems in the RTTI info.

Please advise!!!

 

__fastcall TMainForm::TMainForm(TComponent* Owner)
        : TUniForm(Owner)
{
        int count;
    TPropList list;


   count=GetPropList(PTypeInfo(__delphirtti(TMainForm)),tkAny ,&list, true);
   ShowMessage(IntToStr(count));
}

Link to comment
Share on other sites

  • 2 weeks later...

Here is a problem descripton and workaround:

The problem occurs when a new package & component is built. Lets say a component TUIEdit is inherited from TUniEdit. 

TUniEdit has about 49 properties. The c++ the compiler runs and produces a new object file. In the object file you can see (I am using tdump)

that 51 properties generated even if TUIEdit has no additional properties! So TUIEdit crashes when installed in the IDE as described above.

I am happy to provide a testcase to have this fixed in future versions.

Fix/Workround:

Just uncomment properties. In the example above uncomment 2 properties to get a correct number of 49 properties in the c++ header in the common directory.

 

Link to comment
Share on other sites

11 hours ago, akr said:

Here is a problem descripton and workaround:

The problem occurs when a new package & component is built. Lets say a component TUIEdit is inherited from TUniEdit. 

TUniEdit has about 49 properties. The c++ the compiler runs and produces a new object file. In the object file you can see (I am using tdump)

that 51 properties generated even if TUIEdit has no additional properties! So TUIEdit crashes when installed in the IDE as described above.

I am happy to provide a testcase to have this fixed in future versions.

Fix/Workround:

Just uncomment properties. In the example above uncomment 2 properties to get a correct number of 49 properties in the c++ header in the common directory.

 

We run all of our over 5.000.000 lines of code in Unigui in C++ builder ONLY. Works likea charm. I do not understand. What's the problem?

Link to comment
Share on other sites

It depends. As soon as components are inherited from unigui components like TUniEdit or similiar it crashes as described above. 

Simple as that. Easy to reproduce:

 

1) Create a new Package project in C++

2) Add a component, derived from e.g. TUniEdit. 

3) Compile, install and drag it on a form.

It crashes!

 

We have a C++ application with 150 windows, 10m lines of code and 35 GUI components inherited from vcl. We need to get this fixed and are waiting for UniListView.

Link to comment
Share on other sites

@akr

I have not C++ builder. But on an Unigui delphi Project there is a menu to create 'inherited items" from your existing project forms or frames. You can create an UniguiFrame class which contains an UniEdit component and do what you want...

Link to comment
Share on other sites

@Abaksoft

This works for forms only. I want to create a new designtime component inherited from other components. Still crashing. Unchanged:

class PACKAGE TUIEdit : public TUniEdit
{
private:
protected:
public:
  __fastcall TUIEdit(TComponent* Owner);
__published:
};

GvZP8QK.png

 

Link to comment
Share on other sites

  • 1 month later...
  • 2 months later...
On 7/13/2019 at 11:15 PM, akr said:

Hi,

I am trying to write a unigui custom component. For testing I derived a simple component from TUniEdit.

It compiles and gets installed.

As soon as I put it on a unigui form I get a access violation in rtl250.bpl in function "GetPropList". Qdp7Wap.png

 

Doing the same in Delphi Pascal works fine. Has this ever worked? Any change to get it fixed? We are evaluating unigui for a large C++ application.

 

Sherzod, Farshad, just wanna know if there are any news with C++. Same behaviour in 10.3.3. Still crashing when building components with C++. Everything is described here. Either a unigui or cbuilder bug. Hard to say. cbuilder comsumes headers generated by delphi on install time. Compiles well. But when component is installed in ide it crashes immediately. When I remove a property (e.g. RTL, commented out in uniguiclasses.hpp), some components start working. Strange.

(1509 Demo)

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...