Jump to page: 1 24  
Page
Thread overview
Module Definitions
Sep 09, 2007
Default User
Re: Module Definitions Clarification
Sep 09, 2007
Default User
Sep 10, 2007
Walter Bright
Sep 13, 2007
Default User
Sep 13, 2007
Bertel Brander
Sep 14, 2007
Default User
Sep 14, 2007
Bertel Brander
Sep 15, 2007
Default User
Sep 14, 2007
Walter Bright
Sep 14, 2007
Walter Bright
Sep 15, 2007
Default User
Sep 17, 2007
Walter Bright
Sep 17, 2007
Default User
Re: Module Definitions Clarification - try this
Sep 17, 2007
Andy C
Re: Module Definitions Clarification (was: Re: Module Definitions Clarification - try this)
Sep 17, 2007
Default User
Re: Module Definitions Clarification - SDK/Implib
Sep 18, 2007
Andy C
Sep 18, 2007
Walter Bright
Sep 21, 2007
Bob Paddock
Sep 22, 2007
Walter Bright
Sep 24, 2007
AndyC
Sep 24, 2007
Bob Paddock
Sep 26, 2007
Bob Paddock
linker error messages
Sep 27, 2007
Walter Bright
Sep 28, 2007
Bob Paddock
Sep 28, 2007
Walter Bright
Sep 27, 2007
Walter Bright
Sep 28, 2007
Bob Paddock
Sep 28, 2007
Walter Bright
Oct 03, 2007
Bob Paddock
Oct 10, 2007
Walter Bright
Oct 10, 2007
Bob Paddock
Oct 10, 2007
Walter Bright
Oct 10, 2007
Bob Paddock
Oct 22, 2007
AndyC
Oct 10, 2007
Walter Bright
Oct 10, 2007
Bob Paddock
Oct 11, 2007
Walter Bright
Nov 13, 2007
Bob Paddock
September 09, 2007
Is there an automated way to create module definitions .def file froma dll?

-- 

September 09, 2007
I'm using Digital Mars command-line C++ compiler.

I have to use module definition files as described in FAQ to translate function names:

  	LIBRARY wsock32
	EXETYPE NT
      SUBSYSTEM WINDOWS
      EXPORTS
          _gethostbyname@4  = gethostbyname

That's the only was I can get DM to work, otherwise it spits out a bunch of "Symbol Undefined" errors.

But as you can imagine there are hundreds of funtions that have to be translated via module definition files.

I looked all over the website, but it doesn't describe an automated way to do this anywhere...

Any advise?

-- 

September 10, 2007
Are you trying to convert wsock32.lib from COFF to an OMF import library?
September 13, 2007
On Mon, 10 Sep 2007 11:01:57 -0700, Walter Bright wrote:

> Are you trying to convert wsock32.lib from COFF to an OMF import library?

Hi Walter

I'm trying to do what's described here: http://www.digitalmars.com/faq.html#sysimport

I tried researching COFF vs OMF issue after reading your reply, but I don't quite understand it.

Do you think that this trick with module definition file (as described in the above URL) actually performs OMF to COFF conversion?

If that is the case, why wouldn't they just say so?! That entire paragraph doesn't even mention COFF or OMF...

Do you think I can use some sort of OMF to COFF conversion utility instead of entering everything manually into Module Definition file?
September 13, 2007
Default User skrev:
> On Mon, 10 Sep 2007 11:01:57 -0700, Walter Bright wrote:
> 
>> Are you trying to convert wsock32.lib from COFF to an OMF import library?
> 
> Hi Walter
> 
> I'm trying to do what's described here:
> http://www.digitalmars.com/faq.html#sysimport

But the import library for most windows dlls is included in DMC.
You don't normally need to create the libraries yourself.
September 14, 2007
On Thu, 13 Sep 2007 23:56:39 +0200, Bertel Brander wrote:

> You don't normally need to create the libraries yourself.

So what am I supposed to do? The wsock32.lib which is included by default cannot be used because of its format. Read the URL reference that I gave carefully. All the functions need to be changed from one format to another. If I try to compile without module definitions file, the linker gives out a bunch of "undefined symbol" errors.

I also think I should not be creating all those libraries myself. Especially manually. So what should I do then? It DOES NOT work with the libraries the way they're supplied.
September 14, 2007
Default User wrote:
> Do you think I can use some sort of OMF to COFF conversion utility instead
> of entering everything manually into Module Definition file?

If you mean convert COFF to OMF, you can use \dm\bin\coffimplib.exe which comes with the extended utility package.
September 14, 2007
Default User skrev:
> On Thu, 13 Sep 2007 23:56:39 +0200, Bertel Brander wrote:
> 
>> You don't normally need to create the libraries yourself.
> 
> So what am I supposed to do? The wsock32.lib which is included by default
> cannot be used because of its format. Read the URL reference that I gave
> carefully. All the functions need to be changed from one format to another.
> If I try to compile without module definitions file, the linker gives out a
> bunch of "undefined symbol" errors.
> 
> I also think I should not be creating all those libraries myself.
> Especially manually. So what should I do then? It DOES NOT work with the
> libraries the way they're supplied. 


Sorry, I still can't see the problem.

If I create a program:
#include <windows.h>
#include <stdio.h>

int main()
{
  WSADATA wsaData;
  WSAStartup(MAKEWORD(1, 1), &wsaData);

   struct hostent *h = gethostbyname("www.digitalmars.com");
   if(h)
      printf("%u.%u.%u.%u\n",  (unsigned char )h->h_addr_list[0][0],
                               (unsigned char )h->h_addr_list[0][1],
                               (unsigned char )h->h_addr_list[0][2],
                               (unsigned char )h->h_addr_list[0][3]);
   else
      printf("To bad\n");
}

And compile it with:
dmc testing.cpp wsock32.lib

It works rigth away, without any tricks or defintion files.
The wsock32.lib file is the one supplied by Digital Mars.

So why do you say it does not work?
What happens if you try to compile the above program?
September 14, 2007
Default User wrote:
> On Thu, 13 Sep 2007 23:11:39 -0700, Walter Bright wrote:
>> If you mean convert COFF to OMF, you can use \dm\bin\coffimplib.exe which comes with the extended utility package.
> 
> You are either unable or unwilling to understand what my question is.

I mistyped. To create an OMF import library from a COFF import library, you can use coffimplib.exe.

From reading your posts, that appears to be what you need.
September 15, 2007
On Fri, 14 Sep 2007 21:01:45 +0200, Bertel Brander wrote:

> Sorry, I still can't see the problem.
> 
> If I create a program:
> 
> And compile it with:
> dmc testing.cpp wsock32.lib
> 
> It works rigth away, without any tricks or defintion files. The wsock32.lib file is the one supplied by Digital Mars.
> 
> So why do you say it does not work?
> What happens if you try to compile the above program?

I'm sorry, I got confused in my last post. Your program indeed compiles. Also the example in that FAQ I quoted is misleading because wsock32.lib is supplied by DM and one does not need to translate wsock32 functions.

Here is detailed explanation of what's happening in my case:

Lets say I have c++ program test.cpp which uses WSAConnect function.

WSAConnect is in ws2_32.dll

I do:
implib /s ws2_32.lib ws2_32.dll
dmc test.cpp ws2_32.lib

I get error:
Error 42: Symbol Undefined _WSAConnect@28

So I need to create module definition file "ws2_32.def":
>       LIBRARY wsock32
>       EXETYPE NT
>       SUBSYSTEM WINDOWS
>       EXPORTS
>           _WSAConnect@28  = WSAConnect

Then I do:
implib ws2_32.lib ws2_32.def
dmc test.cpp ws2_32.lib

Now the code compiles.

But what if the code contains hundreds of functions (like WSAConnect in the above example) which are not present in those 18 lib files supplied by DM? Am I supposed to create these module definition files manually by copy and paste even if there are hundreds of funtions?
« First   ‹ Prev
1 2 3 4