Board index » delphi » DLL and Resources

DLL and Resources

We have a 32bit DLL that contains functions ( BCC - non CPP - plain C ).

How would we add a bitmap to that DLL when building the DLL?

Assuming that the DLL is then loaded dynamically at runtime, I require that
the
bitmap stored in that same DLL be loaded from inside a function in that same
DLL using LoadBitmap - how can the bitmap be loaded from inside the DLL?

Thanks in Advance,

Sylvio

 

Re:DLL and Resources


By the way - it's BCC 5.02

Re:DLL and Resources


Add the following line in your DLL's resource file
(or create a new file):
SOME_IDC BITMAP YourBitmapFileName.bmp

In order to load the image at runtime, use one of these API calls:
LoadBitmap, LoadImage, or LoadResource. The hInstance parameter
is the first parameter of the DllEntryPoint function (store it in
TLS so any thread of the process can use it).

BOBA

Re:DLL and Resources


Hi Boba,

what would be the command line (DOS) command to add a RES file to a 32bit
DLL?

What would the RC file look like to add a BMP to the DLL?

Thanks in advance.

Sylvio

Quote
"Boba" <Boba_u3_Xo...@hotmail.com> wrote in message

news:3C13CFBE.7000108@hotmail.com...
Quote
> Add the following line in your DLL's resource file
> (or create a new file):
> SOME_IDC BITMAP YourBitmapFileName.bmp

> In order to load the image at runtime, use one of these API calls:
> LoadBitmap, LoadImage, or LoadResource. The hInstance parameter
> is the first parameter of the DllEntryPoint function (store it in
> TLS so any thread of the process can use it).

> BOBA

Re:DLL and Resources


Quote
Sylvio Girardeau wrote:
> Hi Boba,

> what would be the command line (DOS) command to add a RES file to a 32bit
> DLL?

depends on what you're trying to achieve. Here is an advice:

Feel free to dig around the $env(bcroot)\BIN folder where you'll
find a lot of useful information on how to use the compilers and
linkers for your particular needs. You may also want to read the
manuals shipped with BC5.02: they give almost clear description
of almost all command line switches for different targets and
platforms. If you are just getting started with BC, consider a very
simple path to follow: create a make file for your project from
inside the IDE and open the file with your favorite plain text
editor.

Quote

> What would the RC file look like to add a BMP to the DLL?

//somewhere
#define SOME_IDC 0x1234

SOME_IDC BITMAP YourBitmapFileName.bmp

Quote

> Thanks in advance.

> Sylvio

You are welcome and good luck.

BOBA

Re:DLL and Resources


Hi Boba,

I'm working completely from the command line (batch files).
I should point out that my DLL is loaded dynamically at runtime.

I've created my res file by doing the following:

brcc32 -32 -fomylogo.res mylogo.rc

this is now fine - I have the res file.

Now, I'm trying to bind the res to my dll (contains 32bit c code).  Assume
the
name of the DLL is MYDLL.DLL and it is built by doing:

bcc32 -WD -g0 -M mydll.c

The above creates my DLL ok.

I've been looking at trying to find out how to do this.  If I'm correct,
I should be using TLINK32.EXE correct?  Still haven't found the proper
command line parameters to insert/bind the res file into the dll yet....

That's all I'm missing now.

Thanks again Boba :-)

Sylvio

Re:DLL and Resources


Thanks Ed!!

the ilink32 below worked ( I had to remove the /Gn though).

Thanks Again!

Sylvio

Re:DLL and Resources


I do not know how to bind it without creating a new DLL from object files.

According to the docs this "should" do it but I have not had success with
it:

  ilink32 /Tpd/aa/Rr ,mydll.dll,,,,mylogo.res
  substitute /ap if a console app

This should do it and I have done it:

  ilink32 /Tpd/aa/Gn c0d32 mydll,mydll,,import32 cw32,,mylogo.res

assumptions:
  you already have mylogo.res and mydll.obj

substitutions:
if console app:  /ap for /aa
if dynamic linked  cw32i for cw32
if you want the *.IL? files:  delete /Gn

I haven't used tlink32.exe since C++ Builder 4 came out and cannot remember
surely enough to guarantee this, but I think the command line parameters for
tlink32 would be the same as for ilink32 except for /Gn which tlink32
doesn't use.

.  Ed

Other Threads