Importing some functions from a third-party DLL 
Author Message
 Importing some functions from a third-party DLL

Hi,

I'm importing functions from a third-party DLL (unrar.dll, some of you might
have some experience with that DLL) and I always get linker errors
("unresolved external").

All I have that came with the DLL is the .DEF file with IMPORTS statements
and a .H file declaring the structures and functions used in unrar.dll. I
guess I'm missing something (for instance, there's no .LIB in the package,
and of course I don't have the DLL sources so that I could rebuild it...).

My lack of experience with Win32 programming might prevent me to see the
obvious, I just don't know what to do to get my program to link correctly
(it does compile, thank God :) ). Anyone can see what I'm missing (linker
settings, some code, project settings ?) ?

Following is a cut & paste of the .DEF file. I don't thing it'll help, but
one is always better off with more info than not enough :)

Thanks for your kind help, sincerely

Jeff Gratton

.DEF file:
=======
IMPORTS
  unrar.RAROpenArchive
  unrar.RARCloseArchive
  unrar.RARReadHeader
  unrar.RARProcessFile
  unrar.RARSetChangeVolProc
  unrar.RARSetProcessDataProc
  unrar.RARSetPassword



Wed, 23 May 2001 03:00:00 GMT  
 Importing some functions from a third-party DLL
On Sat, 5 Dec 1998 20:35:48 -0500, "J.F. Gratton"

Quote:

>I'm importing functions from a third-party DLL (unrar.dll, some of you might
>have some experience with that DLL) and I always get linker errors
>("unresolved external").

>All I have that came with the DLL is the .DEF file with IMPORTS statements
>and a .H file declaring the structures and functions used in unrar.dll. I
>guess I'm missing something (for instance, there's no .LIB in the package,
>and of course I don't have the DLL sources so that I could rebuild it...).

I'm not really sure you can link your program without .LIB file, since
without it, the linker can't link the calls you make externally.
Perhaps you can ask the person who wrote unrar.dll.
__
ashier


Thu, 24 May 2001 03:00:00 GMT  
 Importing some functions from a third-party DLL

Quote:
>I'm not really sure you can link your program without .LIB file, since
>without it, the linker can't link the calls you make externally.
>Perhaps you can ask the person who wrote unrar.dll.
>__

That's what I figured, that I needed the .LIB file, but since unrar.dll is
public-domain (well actually a shareware; it's part of the WinRAR95 package)
I thought that someone must have devised a way to link that DLL. I wrote to
the autor, but I'm still awaiting his answer...

Thanks for the answer ! :)

Jeff



Thu, 24 May 2001 03:00:00 GMT  
 Importing some functions from a third-party DLL
Create a file unrar.def with an EXPORTS section and run LIB /DEF:unrar.def
from the command line. This creates an import and export library (unrar.lib
and unrar.exp).
You could also edit the provided .DEF file: change IMPORTS to EXPORTS and
remove unrar. from the function names.
To get a list of all exports of the DLL, run DUMPBIN /EXPORTS unrar.dll from
the command line.

Hope this helps,
Christian Studer

Quote:

>Hi,

>I'm importing functions from a third-party DLL (unrar.dll, some of you
might
>have some experience with that DLL) and I always get linker errors
>("unresolved external").

>All I have that came with the DLL is the .DEF file with IMPORTS statements
>and a .H file declaring the structures and functions used in unrar.dll. I
>guess I'm missing something (for instance, there's no .LIB in the package,
>and of course I don't have the DLL sources so that I could rebuild it...).

>My lack of experience with Win32 programming might prevent me to see the
>obvious, I just don't know what to do to get my program to link correctly
>(it does compile, thank God :) ). Anyone can see what I'm missing (linker
>settings, some code, project settings ?) ?

>Following is a cut & paste of the .DEF file. I don't thing it'll help, but
>one is always better off with more info than not enough :)

>Thanks for your kind help, sincerely

>Jeff Gratton

>.DEF file:
>=======
>IMPORTS
>  unrar.RAROpenArchive
>  unrar.RARCloseArchive
>  unrar.RARReadHeader
>  unrar.RARProcessFile
>  unrar.RARSetChangeVolProc
>  unrar.RARSetProcessDataProc
>  unrar.RARSetPassword



Fri, 25 May 2001 03:00:00 GMT  
 Importing some functions from a third-party DLL
On Sat, 5 Dec 1998 20:35:48 -0500, "J.F. Gratton"

Quote:

>I'm importing functions from a third-party DLL (unrar.dll, some of you might
>have some experience with that DLL) and I always get linker errors
>("unresolved external").

>All I have that came with the DLL is the .DEF file with IMPORTS statements
>and a .H file declaring the structures and functions used in unrar.dll. I
>guess I'm missing something (for instance, there's no .LIB in the package,
>and of course I don't have the DLL sources so that I could rebuild it...).

I stumbled upon an interesting article.

  Create 32-bit Import Libraries Without .OBJs or Source
  Article ID: Q131313 (lucky number?)
  http://support.microsoft.com/support/kb/articles/q131/3/13.asp?FR=0

You might have some difficulty (like I do) if the DLL is written using
non-MS development tools.
__
ashier



Sat, 26 May 2001 03:00:00 GMT  
 Importing some functions from a third-party DLL
Another option is certainly to use LoadLibrary and then GetProcAddress to
retrieve a function pointer to each of the functions you wish to call.

See the documentation for MAPI functions for examples of how this works,
that is how you have to use MAPI functions.

This might be an alternate route.

Eric Brandt
Avatech Solutions

Quote:

>Hi,

>I'm importing functions from a third-party DLL (unrar.dll, some of you
might
>have some experience with that DLL) and I always get linker errors
>("unresolved external").



Sat, 02 Jun 2001 03:00:00 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Importing some functions from a third-party DLL

2. Importing some functions from a third-party DLL

3. Call third-party DLL function

4. Importing third party interfaces that have the same name into an IDL file

5. First-chance exception in third-party DLL

6. First-chance exception in third-party DLL

7. Timing problem in calling third party DLL

8. How to include third-party DLL?

9. Third Party dll and linking / runtime errors.

10. Problem Calling a Third Party DLL

11. XP theme problem with third party dlls

12. Third Party DLLs with Header file

 

 
Powered by phpBB® Forum Software