public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* RE: DLLTOOL documentation?
@ 1997-03-26 10:43 Colin Peters
  1997-03-27  7:23 ` Gary Albert
  0 siblings, 1 reply; 4+ messages in thread
From: Colin Peters @ 1997-03-26 10:43 UTC (permalink / raw)
  To: 'Bruce James'; +Cc: 'GNU-Win32'

Bruce James[SMTP:bjames@clear.net.nz] wrote:
>1. Is there any documentation on DLLTOOL available?

Not much as far as I can figure out. You can get some idea of what it
does by typing "dlltool --help", which gives a brief summary. You can
also look at the Cygwin readmes and FAQ for examples of dlltool in
use (for adding .reloc sections to executables, and for building DLLs).

>2. What's the Gnu equivalent of Borland's IMPLIB for generating an import
>library from a DLL?

That's a good question. I don't think there actually is one. However,
Windows 95 at least you can use the Quick View option on the DLL to get
a list of exports, which you can then laboriously produce your own .def
file from, and then run dlltool on the .def file.

There's probably a better way to do it, but I don't know it.

Colin.

-- Colin Peters - colin@bird.fu.is.saga-u.ac.jp
-- Saga University Dept. of Information Science
-- http://www.fu.is.saga-u.ac.jp/~colin/index.html
-- http://www.geocities.com/Tokyo/Towers/6162/

-
For help on using this list, send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: DLLTOOL documentation?
  1997-03-26 10:43 DLLTOOL documentation? Colin Peters
@ 1997-03-27  7:23 ` Gary Albert
  0 siblings, 0 replies; 4+ messages in thread
From: Gary Albert @ 1997-03-27  7:23 UTC (permalink / raw)
  To: gnu-win32

> Bruce James[SMTP:bjames@clear.net.nz] wrote:
> 
> 2. What's the Gnu equivalent of Borland's IMPLIB for generating an import
> library from a DLL?
> 

I have found that dlltool can do the equivalent of IMPLIB. Doing 
"dlltool --help" gives just enough info to figure it out. All I've 
had to do is:

    dlltool --output-lib somedll.a --dllname somedll.dll

This will create the ".a" file for linking with ld. It can take quite 
a while to run but it seems to work fine. I've used this method to 
actually build a lib for X11 from an X11.dll file I found on the net 
somewhere and it worked great.

___________________________________________________________

garya@fltdyn.com
Gary Albert
Flight Dynamics
(503) 684-5384
___________________________________________________________
-
For help on using this list, send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: DLLTOOL documentation?
  1997-03-25  0:49 Bruce James
@ 1997-03-27  6:07 ` Fergus Henderson
  0 siblings, 0 replies; 4+ messages in thread
From: Fergus Henderson @ 1997-03-27  6:07 UTC (permalink / raw)
  To: Bruce James; +Cc: gnu-win32

Bruce James, you wrote:
> 
> 2 x Q's:
> 
> 1. Is there any documentation on DLLTOOL available?

None that I know of, apart from some documentation in the source code
(which I've appended below), and the output of `dlltool --help'.

> 2. What's the Gnu equivalent of Borland's IMPLIB for generating an import
> library from a DLL?

I don't know what Borland's IMPLIB is, but I suspect that dlltool's
`--output-lib' option is probably what you are looking for.

See also < http://www.cs.mu.oz.au/~fjh/gnu-win32/how-to-build-dlls.html >.

Cheers,
	Fergus.

--
Fergus Henderson <fjh@cs.mu.oz.au>   |  "I have always known that the pursuit
WWW: < http://www.cs.mu.oz.au/~fjh >   |  of excellence is a lethal habit"
PGP: finger fjh@128.250.37.3         |     -- the last words of T. S. Garp.

The following comes from src/binutils/dlltool.c from cdk-src.tar.gz.

/*
   This program allows you to build the files necessary to create
   DLLs to run on a system which understands PE format image files.
   (eg, Windows NT)

   See "Peering Inside the PE: A Tour of the Win32 Portable Executable
   File Format", MSJ 1994, Volume 9 for more information.
   Also see "Microsoft Portable Executable and Common Object File Format,
   Specification 4.1" for more information.

   A DLL contains an export table which contains the information
   which the runtime loader needs to tie up references from a
   referencing program. 

   The export table is generated by this program by reading
   in a .DEF file or scanning the .a and .o files which will be in the
   DLL.  A .o file can contain information in special  ".drectve" sections
   with export information.  

   A DEF file contains any number of the following commands:


   NAME <name> [ , <base> ] 
   The result is going to be <name>.EXE

   LIBRARY <name> [ , <base> ]    
   The result is going to be <name>.DLL

   EXPORTS  ( <name1> [ = <name2> ] [ @ <integer> ] [ NONAME ] [CONSTANT] ) *
   Declares name1 as an exported symbol from the
   DLL, with optional ordinal number <integer>

   IMPORTS  ( [ <name> = ] <name> . <name> ) *
   Ignored for compatibility

   DESCRIPTION <string>
   Puts <string> into output .exp file in the .rdata section

   [STACKSIZE|HEAPSIZE] <number-reserve> [ , <number-commit> ]
   Generates --stack|--heap <number-reserve>,<number-commit>
   in the output .drectve section.  The linker will
   see this and act upon it.

   [CODE|DATA] <attr>+
   SECTIONS ( <sectionname> <attr>+ )*
   <attr> = READ | WRITE | EXECUTE | SHARED
   Generates --attr <sectionname> <attr> in the output
   .drectve section.  The linker will see this and act
   upon it.


   A -export:<name> in a .drectve section in an input .o or .a
   file to this program is equivalent to a EXPORTS <name>
   in a .DEF file.



   The program generates output files with the prefix supplied
   on the command line, or in the def file, or taken from the first 
   supplied argument.

   The .exp.s file contains the information necessary to export
   the routines in the DLL.  The .lib.s file contains the information
   necessary to use the DLL's routines from a referencing program.



   Example:

   file1.c: 
   asm (".section .drectve");  
   asm (".ascii \"-export:adef\"");

   adef(char *s)
   {
   printf("hello from the dll %s\n",s);
   }

   bdef(char *s)
   {
   printf("hello from the dll and the other entry point %s\n",s);
   }

   file2.c:
   asm (".section .drectve");
   asm (".ascii \"-export:cdef\"");
   asm (".ascii \"-export:ddef\"");
   cdef(char *s)
   {
   printf("hello from the dll %s\n",s);
   }

   ddef(char *s)
   {
   printf("hello from the dll and the other entry point %s\n",s);
   }

   printf()
   {
   return 9;
   }

   main.c

   main()
   {
   cdef();
   }

   thedll.def

   LIBRARY thedll
   HEAPSIZE 0x40000, 0x2000
   EXPORTS bdef @ 20
   cdef @ 30 NONAME 

   SECTIONS donkey READ WRITE
   aardvark EXECUTE


   # compile up the parts of the dll

   gcc -c file1.c       
   gcc -c file2.c

   # put them in a library (you don't have to, you
   # could name all the .os on the dlltool line)

   ar  qcv thedll.in file1.o file2.o
   ranlib thedll.in

   # run this tool over the library and the def file
   ./dlltool --def thedll.def --output-exp thedll.o --output-lib thedll.a

   # build the dll with the library with file1.o, file2.o and the export table
   ld -o thedll.dll thedll.o thedll.in

   # build the mainline
   gcc -c themain.c 

   # link the executable with the import library
   ld -e main -Tthemain.ld -o themain.exe themain.o thedll.a

 */
-
For help on using this list, send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".

^ permalink raw reply	[flat|nested] 4+ messages in thread

* DLLTOOL documentation?
@ 1997-03-25  0:49 Bruce James
  1997-03-27  6:07 ` Fergus Henderson
  0 siblings, 1 reply; 4+ messages in thread
From: Bruce James @ 1997-03-25  0:49 UTC (permalink / raw)
  To: Gnu Win32 Submission

2 x Q's:

1. Is there any documentation on DLLTOOL available?

2. What's the Gnu equivalent of Borland's IMPLIB for generating an import
library from a DLL?

Regards
Bruce

-
For help on using this list, send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1997-03-27  7:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-03-26 10:43 DLLTOOL documentation? Colin Peters
1997-03-27  7:23 ` Gary Albert
  -- strict thread matches above, loose matches on Subject: below --
1997-03-25  0:49 Bruce James
1997-03-27  6:07 ` Fergus Henderson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).