Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How do I import LIB and H files to Delphi?

1,190 views
Skip to first unread message

Sharad Srivastav

unread,
Feb 16, 1999, 3:00:00 AM2/16/99
to
Hi all,
I want to import a C Lib file and a Header file as Delphi units to use in
projects... How do I go about it? Any help is appreciated... Thanx in
advance...

Vij

The African Chief

unread,
Feb 16, 1999, 3:00:00 AM2/16/99
to
In article <7abmvk$6v...@forums.borland.com>
"Sharad Srivastav" <sha...@trustmarque.com> wrote:

You cannot use the LIB file (get the DLL, if any, from which it was
produced.). The header file needs to be translated into a Pascal unit
for Delphi to be able to use it. Get Dr Bob's HeadConv program. This
will do most of the job for you - but you might have to make manual
adjustments. HeadConv presumes that the header file is an interface
to a DLL. If there is no DLL, then you are stuck.

Best regards, The Chief
--------
Dr. Abimbola A. Olowofoyeku (The African Chief)
Email: la...@keele.ac.uk
Homepage: http://ourworld.compuserve.com/homepages/African_Chief/
Author of: Chief's Installer Pro v5.00 for Win32
ftp://ftp.simtel.net/pub/simtelnet/win95/install/chief500.zip


Howard Moon

unread,
Feb 16, 1999, 3:00:00 AM2/16/99
to
I'm pretty sure your LIB file won't be compatible with Delphi. You'll
probably need to create a new library in Delphi. If this is a third-party
library, you should contact them to see if they have Delphi-compatible
libraries.
As for the H file, you'll need to create a PAS file and write Pascal code
which defines the same types and constants. Someone may have a utility to
do this, but I'm not aware of it. Of course, I'm not aware of too many
things... ;-).
-Howard Moon

Peter Below (TeamB)

unread,
Feb 16, 1999, 3:00:00 AM2/16/99
to
> I want to import a C Lib file and a Header file as Delphi units to use in
> projects... How do I go about it? Any help is appreciated... Thanx in
> advance...

Delphi cannot read C headers, so you have to translate the header to a
Delphi import unit (all the API units like ShellAPI or Windows are import
units). You do not need the LIB file (i hope this is a DLL link library,
not a collection of OBJ files).

There are tools around that try to automate the translation:

http://www.mop.no/~alex/technical_htrans.html
http://www.drbob42.com

They can do some of the grunt work but some manual post-processing is
usually needed. You can find some general information on how to translate C
to pascal on the Delphi Jedi site: http://www.delphi-jedi.org.

Peter Below (TeamB) 10011...@compuserve.com)
No e-mail responses, please, unless explicitely requested!


Sharad Srivastav

unread,
Feb 17, 1999, 3:00:00 AM2/17/99
to
Thanx to all... I've written the Pascal declarations... I guess i dont need
the Lib file... And thanx Peter, I'll take a look at those websites...

Vij

Sharad Srivastav wrote in message <7abmvk$6v...@forums.borland.com>...
>Hi all,


>I want to import a C Lib file and a Header file as Delphi units to use in
>projects... How do I go about it? Any help is appreciated... Thanx in
>advance...
>

>Vij
>
>

0 new messages