Board index » cppbuilder » How to generate .lib with ilink32 ?

How to generate .lib with ilink32 ?


2004-11-29 06:24:33 AM
cppbuilder92
I'm trying to compile SDL.dll (open source library) on BCB5. After
modifying the makefile, a SDL.dll and a SDL.lib are generated. If I link
MY SDL.lib (~6KB) in my program there are lots of external objects cannot
be resolved. If I use MY SDL.dll and someone's SDL.lib (~20KB) there's no
error message. I believe this is not the right way. But everything SEEMS
alright for few months.
But now, my program crashes and BCB shows me somewhere in memory.stl file
when a 'new' tries to allocate an object from the library. I've got some
questions:
1) Am I right, that lib-file is used to tell the program about all the
external objects which will be loaded from the dll-file?
2) Can I use a lib-file from other compiler with my dll-file?
3) I'm using ilink32 of BCB5. In the online help, I found /Gl for
generating lib-file. But in my makefile it's using -Gi . When I change it
to /Gl no lib-file was generated and I can't find Gi anywhere. Is -Gi
correct?
4) Obviously, my lib-file is missing a lot of infoemation (also too
small). Since I've only adapted the makefile to my compiler I guess that
all the obj-files are linked. What am I doing wrong so that so many
unresolved objects found when I used my own lib-file?
thanks in advance
Phuoc Can HUA
--
_/\__/\__/\__/\__/\__/\_
www.folksfun.com
 
 

Re:How to generate .lib with ilink32 ?

PC Hua <home-AT-huaonline.DOT.com>wrote:
Quote
1) Am I right, that lib-file is used to tell the program about all the
external objects which will be loaded from the dll-file?
Yes. That's why it's generated in parallel to the DLL. It's called
the DLL's "Import library". If you didn't know this before you
started this project, you may lack the qualification needed to pull it
off. I feel obliged to recommend some general studies in how DLL
building and usage works on Windows.
Quote
2) Can I use a lib-file from other compiler with my dll-file?
Almost certainly not.
Quote
3) I'm using ilink32 of BCB5. In the online help, I found /Gl for
generating lib-file. But in my makefile it's using -Gi .
Why? Where did you get that makefile entry from?
Quote
When I change it to /Gl no lib-file was generated and I can't find
Gi anywhere. Is -Gi correct?
Ask the ilink32 you're actually using: just run
ilink32
without any arguments, and look at what it prints.
--
Hans-Bernhard Broeker ( XXXX@XXXXX.COM )
Even if all the snow were burnt, ashes would remain.
 

Re:How to generate .lib with ilink32 ?

Start by reading this:
www.mulroy.org/oview.htm
After that read this:
A DLL exports functions. The names of those functions are
in a table in the DLL file. Your program can implicitly
link to the DLL, calling the functions from your source
code without having to manually load the library, if you
provide information to the linker which defines what the
DLL provides. That can be done with a module definition
file (a *.DEF file) or with another kind of file called
an import library. Import libraries have the file name
extension of .LIB Different compiler systems often use different formats for import libraries but almost all
will accept a module definition file.
You can generate a module definition file from the DLL
with a command like this:
impdef filename.DEF filename.DLL
You can generate an import library file from the DLL
with a command like this:
implib -c filename.LIB filename.DLL
The linker option /Gl when used as it is creating a DLL
causes ilink32 to do the above command for you.
. Ed
Quote
PC Hua <home-AT-huaonline.DOT.com>wrote:
I'm trying to compile SDL.dll (open source library)
on BCB5. After>modifying the makefile, a SDL.dll and
a SDL.lib are generated. If I link MY SDL.lib (~6KB)
in my program there are lots of external objects cannot
be resolved. If I use MY SDL.dll and someone's SDL.lib
(~20KB) there's no error message. I believe this is
not the right way. But everything SEEMS alright for few
months.

But now, my program crashes and BCB shows me somewhere
in memory.stl file when a 'new' tries to allocate an
object from the library. I've got some questions:

1) Am I right, that lib-file is used to tell the program
about all the external objects which will be loaded from
the dll-file?
2) Can I use a lib-file from other compiler with my
dll-file?
3) I'm using ilink32 of BCB5. In the online help, I
found /Gl for generating lib-file. But in my makefile
it's using -Gi . When I change it to /Gl no lib-file
was generated and I can't find Gi anywhere. Is -Gi
correct?
4) Obviously, my lib-file is missing a lot of
infoemation (also too small). Since I've only adapted
the makefile to my compiler I guess that all the
obj-files are linked. What am I doing wrong so that so
many unresolved objects found when I used my own lib-file?
 

{smallsort}

Re:How to generate .lib with ilink32 ?

On 28 Nov 2004 15:41:00 -0700, Hans-Bernhard Broeker
< XXXX@XXXXX.COM >wrote:
Quote
PC Hua <home-AT-huaonline.DOT.com>wrote:

>1) Am I right, that lib-file is used to tell the program about all the
>external objects which will be loaded from the dll-file?

Yes. That's why it's generated in parallel to the DLL. It's called
the DLL's "Import library". If you didn't know this before you
started this project, you may lack the qualification needed to pull it
off. I feel obliged to recommend some general studies in how DLL
building and usage works on Windows.
Certainly, I need it. Can you recommend any sites or books. The thick hand
books come with the compiler only explain what the options do, but not why
and in which case I need it :-(
Thank you for your quick response.
--
_/\__/\__/\__/\__/\__/\_
www.folksfun.com
 

Re:How to generate .lib with ilink32 ?

I think you want to use implib. After you have built the some.dll file, run
implib:
implib some.lib some.dll
this will create some.lib which can be linked to, either statically, or
dynamincally, example...
ilink32 c??32 my.obj...., import32.lib cw32???.lib some.lib,,
that should give you the picture....
Regards
"PC Hua" <home-AT-huaonline.DOT.com>wrote in message
Quote
On 28 Nov 2004 15:41:00 -0700, Hans-Bernhard Broeker
< XXXX@XXXXX.COM >wrote:

>PC Hua <home-AT-huaonline.DOT.com>wrote:
>
>>1) Am I right, that lib-file is used to tell the program about all the
>>external objects which will be loaded from the dll-file?
>
>Yes. That's why it's generated in parallel to the DLL. It's called
>the DLL's "Import library". If you didn't know this before you
>started this project, you may lack the qualification needed to pull it
>off. I feel obliged to recommend some general studies in how DLL
>building and usage works on Windows.
Certainly, I need it. Can you recommend any sites or books. The thick hand
books come with the compiler only explain what the options do, but not why
and in which case I need it :-(

Thank you for your quick response.



--
_/\__/\__/\__/\__/\__/\_
www.folksfun.com