Site icon Embarcadero RAD Studio, Delphi, & C++Builder Blogs

Practical Info: Packages in C++Builder 12.2

We’ve released the new Windows 64-bit Modern C++ toolchain over time: a preview in C++Builder 12.0 through to fully complete in 12.2 (dynamic package linking, CMake support, parallel building by default, etc.) In 12.2, it is a full replacement for the old Win64 toolchain.

But we’ve seen a few customers say, ‘Looks exciting, and I want to use it, but where are packages?’

They’re here.

The source of that might be that we released in stages, a ‘ship in public’ approach with as open communication as we could. And one of those releases did not include dynamic linking to packages. But it’s there now.

And we wrote a bunch of extra documentation, too.

Creating Packages in C++Builder 12.2

12.2’s Win64 Modern toolchain is a full replacement for the old toolchain. That means:

  1. You can create a package through File > New > Package – C++Builder, or on the Welcome screen:
  2. If you have a package, just turn on the platform in the Projects view
    [image]

It’s really as simple as that.

Making Delphi Components work in C++Builder 12.2

Ok, that was too easy. Most components are written in Delphi, though, and put into Delphi-source packages. If you are a package author, and this section is mostly for third party component vendors, you need to enable the new Win64 platform.

How? Steps are in Build Delphi Packages for C++. (Basically, add the platform and rebuild; you need to pay attention to the output folder since while the headers are the same, the package import library and package static library are COFF format. If you have a build script instead of building in-IDE, there are new compiler flags. See the doc page for info.)

Documentation

Packages are a feature that are part of our multi-language support, where we support direct ABI-level interop with Delphi, and are effectively a Delphi feature transplanted to C++. They’re very useful for things like components or controls, and are a DLL plus metadata/extras. (For components, this means supporting registration of the component/control types, for example.)

But because they are not a ‘native’ C++ feature, over the years we’ve had many questions about various aspects of using them. So, matching the brand new package implementation in 12.2, we wrote new docs. This includes concrete recommendations for how to use them, suggested do-s and don’t-s.

Some specific questions we’ve seen are: how do I know when a type is exported from a package, or imported into a package? (What does that even mean?) What is unit initialization? What should I do to use packages in the way they’re meant to be used?

These should all be answered here:

Remember, the new Windows 64-bit Modern toolchain in C++Builder 12.2 is the one we recommend you use. Not only does it have a revised and more robust implementation of packages, but we have significant documentation too.

Happy coding!

 

Exit mobile version