Using Borland’s C++ Builder to create
Resource DLLs
by Jean-Pierre Martel, editor of the dBulletin


In a previous article, we saw how to use Borland's Resource Workshop to store images (icons and BMPs, exclusively) in a DLL. Unfortunately, as soon as the number of resources stored in a DLL created by Resource Workshop gets around 30, dBASE chokes on some of them. The images can be seen and selected when one tries to datalink a control to a resource. However, as soon as the OK button is pushed, an error message appears saying that the resource can't be found.

In our 13th issue, Dan Howard wrote an article on how to use Borland's free C++ Compiler to create a resource DLL. Of course, what's possible with the compiler is also possible with the full application. In the present article, we will use version 4.0 of Borland's C++ Builder. The complete version of that application was given for free with the May 2000 issue of the PC Plus (anUK magazine). For those who missed the occasion, I wouldn't be suprised if Borland would repeat the experience in the future.

To create a resource DLL, there is only one prerequisite: we need a .RC resource file. A .RC file is just a special ASCII file in which the names of the images to be included in the DLL are listed. Since the main module of that compiler is a DOS executable, the short name of the images must be used in that .RC file.

To create a resource DLL, load C++ Builder. Select the menu item File|New… then, in the New Items dialog box, select the Console Wizard icon (not the DLL icon) and click the OK button. In the Console Application Wizard dialog box, select the DLL radiobutton and click the Finish pushbutton.

C++ Builder will open a new floating Windows called “ProjectX” (“X” being the number of the Project). Select the menu item Project|Add to Project…. At the bottom of the Add to project dialog box, there is a combobox: select the item Resource files (*.rc) in order to display the .RC files. Go to the appropriate folder and select your .RC file. The line USERC("PathName\ResourceFileName.rc"); will be added to the C++ code. Click the Open pushbutton.

Select the menu item Project|Build Project: a new DLL that bears the same name as your Project will be created. That DLL will be located in \Projects sub-folder (one of the C++Builder sub-folders).


dBASE is completly unable to create DLLs. C++ Builder fill that gap and completes very well dBASE. Contrary to Borland's Resource Workshop, C++ Builder can store a large number of images in a resource DLL and is not limited to .ICO and .BMP files.