Warm tip: This article is reproduced from stackoverflow.com, please click
delphi c++builder .lib

How can I link a static lib generated by DCC32 with the option -JL in C++builder?

发布于 2020-03-30 21:12:03

I'm trying to use a static library in my C++ Builder project. The lib is created by using DCC32 to compile Delphi source code with -JL option. My Delphi source code is design as a "Designtime and runtime" package, which mean s all the code is built into one package. I want to know how can I use this static library in our C++ Builder project? Thanks in advance.

Questioner
MartinZ
Viewed
68
Rudy Velthuis 2019-04-02 01:20

As David said, the Delphi compiler can't create static lib files at all. What you are trying to link to is an import library for a designtime/runtime package.

Delphi (and C++Builder) packages are not static libs, they are DLLs with a lot of extra information onboard, which makes it easy for Delphi and C++Builder code to link to them and the types inside. They are more or less equivalent to C# assemblies (guess where the C# people got the idea ;-).

To use such a package, in case you really want to use them, select the "build with packages" option from the project options and select this package too.

But if you want to create a single, standalone application, you don't build with packages and the Pascal files get linked into your application as if they came from a static library. But instead of specifying one lib file, you simply specify the .pas files in the project manager, i.e. you simply add the bunch of .pas (or .obj) files to your application directly.

The project will take care of compiling the Pascal files and linking them to your application.

Note that to install components into the IDE, you need a design time package (and that might link to a runtime package). But you don't need packages for your application.