How to create runtime and design time packages using c++ and NOT Delphi [Edit]

Hello,

I'm creating an Embarcadero component package, written in c++. Up to now, the runtime and design time parts were grouped together in my package, and I did not really need to have two versions of my package, because the difference in code between runtime and design time was very small. But now, I need to add a property editor in my package, meaning add a form that will be used exclusively on design time. I tried to separate my package in 2 distinct projects, one for runtime and other for design time, and f
ollowing some documentation, I built the runtime part, then I added the designide.bpi and myRuntimePck.bpi in the Requires part of the design time project. Unfortunately, the runtime project compiles fine, but the design time project does not record the components I've created. Before, these same components were registered without problems when my package contained both runtime and design time parts.

The problem is that I found many examples and documentation on how to create a such package in Delphi, but nothing in c++. The only mention I found about a c++ design time package is here: http://docwiki.embarcadero.com/RADStudio/XE4/en/Registering_the_Component. As mentioned in this document, the code below must be added in each unit containing a component to add to the Embarcadero tools palette:

{code}
namespace MyComponent
{
    void __fastcall PACKAGE Register()
    {
        TComponentClass classes[1] = {__classid(TMyComponent)};
        RegisterComponents("Samples", classes, 0);
    }
}
{code}

But all my component units are declared inside the runtime package, and I NEED THEM for runtime! And I found no example or documentation that explain how to declare a c++ component in runtime package and register in design time package! So, I would like to know how to separate runtime and design time packages, when components classes are written in c++? Is there any example or document about this?

Regards

Edited by: Jean-Milost Reymond on Oct 10, 2013 10:10 AM
0
Jean
10/10/2013 5:10:36 PM
embarcadero.cppbuilder.writing 359 articles. 0 followers. Follow

2 Replies
1806 Views

Similar Articles

[PageSpeed] 48

Jean-Milost wrote:

> I'm creating an Embarcadero component package, written in c++. Up to
> now, the runtime and design time parts were grouped together in my
> package, and I did not really need to have two versions of my package,
> because the difference in code between runtime and design time was
> very small.

More correctly, you can group the two codebases into a single package **only 
if** your design-time code does not do anything that is not forbidden in 
run-time code, such as implementing design-time editors/wizards.  If all 
your design-time code is doing is registering your component(s), then that 
is fine because RegisterComponents() is implemented in the RTL's runtime 
package.  But anything beyond that, you must split the code into separate 
run-time and design-time packages.  Design-time code is not allowed to be 
linked into run-time executables.

> But now, I need to add a property editor in my package, meaning add a
> form that will be used exclusively on design time.

That would warrant a split, yes.

> I tried to separate my package in 2 distinct projects, one for runtime
> and other for design time

That is the correct thing to do.  The run-time package must be marked in 
the Project Options as being runtime only, and links to the RTL/VCL runtime 
packages as needed.  The design-time package must be marked as being designtime 
only in the Projct Options, link to the RTL's DesignIDE package, and Require 
your runtime package.

> following some documentation, I built the runtime part, then I added
> the designide.bpi and myRuntimePck.bpi in the Requires part of the
> design time project.

Yes.

> Unfortunately, the runtime project compiles fine, but the design time project
> does not record the components I've created.

Did you move your Register() function from the run-time package into the 
design-time package?  Is the Register() function wrapped in a namespace whose 
name matches the filename that contains it?

> But all my component units are declared inside the runtime package,
> and I NEED THEM for runtime!

As they should be, since the component(s) are **implemented** in the run-time 
package.  But by requiring the run-time package to be linked to the design-time 
package, and #includ'ing your component's .h/.hpp file(s) into the design-time 
package's source code, you can **access** the components in your design-time 
code.

--
Remy Lebeau (TeamB)
0
Remy
10/10/2013 6:28:35 PM
> {quote:title=Remy Lebeau (TeamB) wrote:}
Is the Register() function wrapped in a namespace whose
name matches the filename that contains it?
{quote}

Hi Remy,

Yes, it was the problem. I just modified the namespace according to the file in which I declared the Register() function, and my component was registered as before. Great help, thanks.

I think that this information about the namespace should be explained more clearly in the Embarcadero documentation, because it's not very intuitive.

Regards
0
Jean
10/10/2013 8:05:18 PM
Reply:

Similar Artilces:

Can anybody debug a design-time package using Delphi XE2
Hello Can anybody debug a design-time package using Delphi XE2? I ask a few developers i know and nobody can. I'm able to do it with no problems in XE and previous versions since I remember. Or How can i debug a design-time package in XE2 using another Delphi process as the Host? When I try to run, using with Project Options - Debugger - Host = 'c:\program....\bds.exe' bds.exe stops almost immediately, no errors if I try, Run + Attach to Process... and select other instance of bds.exe Both Delphi processes crashes. This is VERY important, I wo...

Can I use a components package created in C++ inside a Delphi form?
Hello, I recently created a component package, containing many controls, that I'm commonly using for my forms and projects. This package was written in C++, using RAD Studio XE7 C++ Builder. All the controls inside this package inherit from some VCL components, written in Delphi, and cohabitation has never been a problem. Until now, I always used these components in C++ projects, and in this context, I never experimented problems with that. But now, I need to write a Delphi form. There is no alternative, I MUST write a Delphi form. So, I created a new Delphi form project, and I noticed that my component toolbar did not appear. I checked if my package installation was incorrect, it seems not. So, I searched on the internet what was the problem, and it seems that Delphi code cannot use components built in C++. At best, C++ code can be used in Delphi via a DLL, or a COM object. So, my questions are: - It is possible to use component package written in C++ inside a Delphi project? - If yes, how can I do that? Regards Jean-Milost Reymond wrote: > Hello, > > I recently created a component package, containing many controls, that I'm commonly using for my forms and projects. This package was written in C++, using RAD Studio XE7 C++ Builder. All the controls inside this package inherit from some VCL components, written in Delphi, and cohabitation has never been a problem. Until now, I always used these components in C++ projects, and in this contex...

On Using C++ code from Delphi [Edit]
Hello, one of the most frequently requested - but never realized - features for Delphi is the ability to use C++ code. I'd like to know about your needs regarding C++, and how you think about such a feature. - Is it critical for you to be able to use 3rd-party C++ libraries and C++ classes in Delphi without further changes or additional work? - Or do you want to use VCL components written in C++ in your Delphi projects? - Imagine a solution that makes C++ classes visible to Delphi code, with the following restrictions: o the C++ code needs to be built with C++Builder, o t...

Using 7zip delphi wrapper from C++ [Edit]
I'm trying to utilize "7za.dll" together with this Delphi wrapper - http://www.progdigy.com/?page_id=13 Download of the wrapper itself is here - http://code.google.com/p/d7zip/downloads/detail?name=d7zipv1.2.zip&can=2&q= Having difficulties translating this code to C++ and understanding the wrapper itself: {code} procedure TMainForm.ExtractAllClick(Sender: TObject); var Arch: I7zOutArchive; begin Arch := CreateOutArchive(CLSID_CFormat7z); // add a file Arch.AddFile('c:\test.bin', 'folder\test.bin'); // add files using willcards and recursive search Arch.AddFiles('c:\test', 'folder', '*.pas;*.dfm', true); // add a stream Arch.AddStream(aStream, soReference, faArchive, CurrentFileTime, CurrentFileTime, 'folder\test.bin', false, false); // compression level SetCompressionLevel(Arch, 5); // compression method if <> LZMA SevenZipSetCompressionMethod(Arch, m7BZip2); // add a progress bar ... Arch.SetProgressCallback(...); // set a password if necessary Arch.SetPassword('password'); // Save to file Arch.SaveToFile('c:\test.zip'); // or a stream Arch.SaveToStream(aStream); end; {code} I've made additional wrapper of wrapper Delphi unit which when included in C++ code wraps above and it works. Now I'd like to use it a step further - call the above in C++ code directly. How do I initia...

Creating a TFrame at runtime using cb2010 [Edit]
Hi, I’ve got a problem, to include a frame in a form. The frame should be build at runtime. So I can not put it directly from the Tool Palette into the frame. The special thing is, that the frame inherits components form an other frame. TItem ->Visible is set false in the editor. {code} // ---------------------------------------------------------------------- class TItem : public TFrame { __published: TPageControl *pcTabs; TScrollBox *sbxTreeItem; public: __fastcall TItem (TComponent* Owner):TFrame(Owner){}; }; extern PACKAGE TItem * ItemFrm; // ----------...

Using a TForm in a Design-time Component [Edit]
Hi good folks, Please help fixing my ignorance. Are there special caveats to avoid and protocols to follow if one uses TForm (or descendants of it) instances within a Delphi design-time component? I ask because I noticed that I can do this until I start noticing this: 1. The client Delphi program using the BPL complains about not finding the DFM file. I solved this by pointing the client project's search path to the location of the DFM. This already smells ... Appreciate any insight here. 2. Once over the missing DFM issue, I could get to compile the client project but w...

Rad XE5 Using Delphi Package with C++
Hi there I'm just starting with Rad XE5 Studio, worked previously with CB6. I installed the +-------------------------------------------------+ | ComPort Library version 4.10 | | for Delphi 5, 6, 7, 2005, 2006, 2007, 2010, XE | | and C++ Builder 3, 4, 5, 6 | | | | by Dejan Crnila 1998-2002 | | maintained by Lars Dybdahl and Paul Doland | | maintained by Brian Gochnauer Nov 2010 | +-------------------------------------------------+ under Delphi VCL App...

Files involved in creating/using packages [Edit]
Hi folks, In an effort to get my mind completely around the roles and relationships of files involved in components and packages, I've visited almost the entire internet. I've assembled all this into a convenient summary table. I'd appreciate any expert input affirming or correcting this, and clueing me in on the few remaining question marks. http://grahamwideman.wikispaces.com/Delphi+--+notes+on+packages [*] The remaining questions (outside of any outright errors I've made) are mostly about the roles of .dcp files. Beyond that, I think this exercise might b...

XE5
For Win32 C++B projects this is working. The C++ files are created by the Delphi compiler and distributed appropriately on installation. The components appear in the IDE for C++B projects and behave as expected at design-time and run-time. Attempting to run a Win64 C++B project gets an 'Application Error' dialog with message 'The application was unable to start correctly (0xc000007b) ... The 64-bit C++B files (.o,.hpp,.bpi and .a ) are put in $(BDE)/Lib/Win64/$(config) and $(BDSCommondir)/hpp, $(BDSCommondir)/Win64/dcp. This is the same as the Win32 distribution so I ...

creating ssis package using C#.net
Hi friends I have created a package using C#.net myPackage.PackageType = DTSPackageType.DTSDesigner90;            myPackage.Name = "MySSISPackage";            myPackage.Description = "Created using the SSIS API";            myPackage.CreatorComputerName = System.Environment.MachineName;            myPackage.CreatorName = "Otey";  &nbs...

Creating and using simple package (bpl) [Edit]
I read the Help and it describes (mostly for Delphi) how to make a package file. I did the same with Builder but it doesn’t seem to work. First of all I created a simple VCL application with one form and I added another form (unit2.h). I then created a new package (File->New->Package - C++Builder), called InsPackage. I then added the second form from the main app to the package. According to the Delphi’s help, I am supposed to leave the second form in the main application and only add the newly created package to the main application (Options->Packages->Runtime packages). ...

TX and RX using socket (Ethernet port) using BCB C++ 2006 Edition [Edit]
Hi All, I'm using BCB C++ 2006 edition. Kindly let me know how to carry out TX and RX in sockets(C++ Builder). I'm a newbee to the BCB world. Kinly post the code or pseudocode if possible. Thanks. Edited by: guddappa th on Jan 5, 2011 8:09 AM ...

How to create and edit xml file using xmldocument in c#
Hi,  I want to create a xml file using xmldocument class in c#. I created a xml file using xmldocument without  prefix tags. But i want the xml file using prefix tags. And you also send me how to edit the data in between the tags. I  give the model tags below.<?xml version="1.0" encoding="utf-8"?><view:view xmlns:view="http://www.alfresco.org/view/repository/1.0" xmlns:cm="http://www.alfresco.org/model/content/1.0" xmlns:app="http://www.alfresco.org/model/application/1.0" xmlns:pk="http://www.swingwind.com/model/pariksha/1.0 ">    <pk:multiplechoiceque...

Delphi / FireMonkey release components created at runtime [Edit]
Hello, XE6, Win7 Am I right I thinking that if I create a component, such as TImage, at runtime, Delphi automatically releases the memory when the program closes. I declared this: im: TImage; as a TForm variable. Put this in .FormCreate: ReportMemoryLeaksOnShutdown := DebugHook <> 0; This picks up things like TStrokeBrush when I don't run .Free; I then put this in: procedure TFrmScales.Button4Click(Sender: TObject); begin im := TImage.Create(self); im.Bitmap.Assign(I_note.Bitmap); // I_note is a TImage that I put there at design-time im.Pa...

I Use C# at Work and Still Prefer Delphi [Edit]
I've been using C# and Visual Studio at work, but I still keep coming back to Delphi. Here what I think Delphi has over C# and VS. Some features I prefer/need: sets and set operations virtual constructors deterministic and virtual destructors virtual static methods messaged based method and DefaultHandler implementation through delegation assign and assignto property promotion published section access to source code examples of property editors, component editors, experts, design time support full library source code interface and implementation sections design time bina...

To get the id of the control which is created during runtime using C#
Hi all, I am been struggling to get the solution for this problem. I need to get the id of the control using javascript which is created during runtime using C#. I have the following code in C# and javascript respectively. //C# dgrd = new DataGrid();//Create an instance of the datagrid to display the rejected documents infodgrd.ID = "dgrdRejcDocs"; dgrd.ForeColor = ColorTranslator.FromHtml("#333333"); ; dgrd.GridLines = GridLines.None; //javascript  var obj = document.getElementById("dgrdRejcDocs"); ---->here i am getting null value ...

How to create gzip file at run-time using C#
Hi, everybody.Can anybody help with gzip creation in c#?Thanks. http://www.practicalguy.com/ alexey.popikov: Hi, everybody.Can anybody help with gzip creation in c#?Thanks. http://www.west-wind.com/Weblog/posts/10564.aspx http://aspalliance.com/1269_Zip_and_UnZip_files_in_C_using_J_libraries http://forums.asp.net/p/1377590/2935983.aspxMAKMark as Answer if this reply helps youMVP ASP/ASP.NetASP.Net Hosting : Host DepotMy Site : ASPSnippets Hi, The following links talk about how to do that: http://www.dotnetspider.com/resources/22486-Zip-Unzip-files-using-C.aspx http://www.nice...

[RSXE] AV in IDE when creating the most basic design-time package
Using RAD Studio XE Enterprise on Win7 64bit Pro I am having problems recompiling some of my C++Builder design-time packages. So, I have uninstalled all third-party packages (including my own) and left only the standard Embarcadero-installed packages in the system. I created an empty C++Builder package, built, and installed it. I closed and restarted the IDE then rebuilt the package. The IDE threw the following AV and the file menu went blank: Access violation at address 14FD1EEE. Read of address 14FD1EEE. (See end of post for supporting details) At this point the IDE was frozen...

How to create a non-modal design time form correctly? [Edit]
Hello, I recently tried to create a design time form, which allows to directly view the content of a non-visible object on the interface itself, in a manner that I can immediately see the impact of the changes in the properties of this object. As expected, the form appears on the design-time editor, but there are 2 issues that I cannot resolve: 1 - the Embarcadero design-time editor itself becomes partially frozen. E.g. the interface is not automatically redrawn as before, or some of the Embarcadero tools and menus are not visible (I can see they are selected, but content is not shown) dur...

Using C++ Code in Delphi XE4 64-bit [Edit]
I am interested in using C++ code in a Delphi XE4 Pro 64-bit app (no iOS, I did not want to pay the "nominal fee", at least not yet). I don't want to use a DLL, I want to link the C++ right into the 64-bit EXE. It is not easy finding info on this online, there's some stuff but not enough to answer all my questions. 1) Do I need to use C++ Builder 64-bit to create object files that can be linked via $LINK in Delphi XE4 64-bit? Or can I create them using Visual Studio? 2) Do I need to "flatten out" C++ classes in order to share them with Delphi or to share them ...

How to create and edit the xml file using xmldocument class in c#
Hi,  I want to create a xml file using xmldocument class in c#. I created a xml file using xmldocument without  prefix tags. But i want the xml file using prefix tags. And you also send me how to edit the data in between the tags. I  give the model tags below. <?xml version="1.0" encoding="utf-8"?><view:view xmlns:view="http://www.alfresco.org/view/repository/1.0" xmlns:cm="http://www.alfresco.org/model/content/1.0" xmlns:app="http://www.alfresco.org/model/application/1.0" xmlns:pk="http://www.swingwind.com/mod...

Debugging applications compiled using run time packages [Edit]
I am having a problem debugging applications developed using Delphi XE2 on Windows 7. If I compile the application using run time packages and set a breakpoint in the code, the program will stop at the breakpoint but it shows the CPU pane rather than the source code for the module with the breakpoint. Single stepping through the code steps me one assembler instruction at at time. If I change the project options to NOT use run time packages everything works as it should. So, I guess the question is, how do I debug an application compiled using run time packages? More information: It...

Create NVO using Power Designer 8.0
Hi, Using Power Designer 8.0 Object Oriented model you can create a class diagram (or class/NVO) and add methods to it using class diagram GUI .When you select Generate Power Builder option from menu it will create a .sru file in selected directory .Using this .sru you can import this file in PB environment and create a NVO. But I could not add arguments/parameters to the methods I created in the class using Power Designer 8.0. Can anybody post how arguments can be added to the methods using Power Designer 8.0 Regards, -------------------------------------------- Sudheer Kondla (W...

Delphi IDE
I am using an external manifest file to support UAC elevations via the RC to RES technique. Once I do this, I have to add the Theme aware info to that manifest or I get resource warnings. To get rid of the warning, I uncheck the themes option on the project. This works fine, but the IDE shows the form designer as non-themed. When it the runs, it is themed, but not in the designer. I am using Delphi 2010, but I tried on Delphi XE3 with the same results. If I use the Delphi XE3 "Use custom manifest" option, it works fine. Is there a way to use an external manifest and still have the IDE show a themed form designer using Delphi 2010? Thanks. Isaac wrote: > I am using an external manifest file to support UAC elevations via the > RC to RES technique. > > Once I do this, I have to add the Theme aware info to that manifest Yes. If you use a custom manifest, you have to provide ALL manifest values that your app uses. At this time, Delphi is not able to merge multiple manifest sources into a single manifest resource (that would be a nice feature to have). > To get rid of the warning, I uncheck the themes option on the project. Yes, you must do that if you provide a custom manifest. > This works fine, but the IDE shows the form designer as non-themed. > When it the runs, it is themed, but not in the designer. Since the Form Designer runs within the IDE process, it should be using the IDE's theming, n...

Web resources about - How to create runtime and design time packages using c++ and NOT Delphi [Edit] - embarcadero.cppbuilder.writing

Quad Flat No-leads package - Wikipedia, the free encyclopedia
Flat no-leads packages such as QFN ( quad-flat no-leads ) and DFN ( dual-flat no-leads ) physically and electrically connect integrated circuits ...

Bomb squad clears package left at Oakleigh Police Station - HeraldSun Search Search
A SUSPICIOUS item found at Oakleigh Police Station has been deemed safe by police.

Childcare package so confusing, some parents may give up on childcare: Mission Australia
The federal government's flagship childcare reforms are so difficult to understand, some parents may give up and pull their children out of care, ...

Verizon, Sued by Disney, Adds ESPN to a Basic TV Package
Verizon Communications, sued by Walt Disney Co. for excluding ESPN from a basic TV package, says it will offer customers two low-cost bundles ...

Google has a clever idea to let its self-driving cars deliver your packages
... It could happen. The company has a clever idea for autonomous delivery platform where self-driving vehicles would port loads full of packages ...

Africa Premiere for Massey Ferguson’s Farm Mechanisation Package at US/Africa Business Summit in Addis ...
Massey Ferguson's Farm Mechanisation Package is at the heart of AGCO&rsquo;s strategy to help transform agriculture in Africa through inclusive ...

In Midst Of Disney Lawsuit, Verizon Creates FiOS “Custom TV” Package That Includes ESPN
... TV makes the whole idea significantly less customizable. The concept announced last spring was that customers would pay $55 for a core package ...

Volunteers Send Care Packages To America’s Dogs On The Front Line
Volunteers Send Care Packages To America’s Dogs On The Front Line

Senate Democrats block energy bill over Republican refusal to add Flint aid package
... a number necessary to move ahead on the bipartisan legislation, the first such bill in nine years. Democrats proposed a $600 million aid package ...

Four Studios Bidding On ‘Gone Girl’ Author Gillian Flynn’s Short Story ‘The Grownup:’ Hot Package Du ...
EXCLUSIVE : While most of the movie deal makers are focused on Berlin, there’s a hot package in Hollywood that has got studios hot and bothered. ...

Resources last updated: 2/23/2016 12:18:37 PM