September 15, 2007
On Fri, 14 Sep 2007 15:03:35 -0700, Walter Bright wrote:

> 
> 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.

Thanks Walter,

I tried coffimplib and it always says:
Error: missing archive signature

I read that it only works with microsoft import libraries (Are these the .lib files that would normally come with Microsoft Visual Studio?). But I only have dlls that normally come with Windows and whatever files came with dmc; I do not have those microsoft lib files. Is there a way to get them without MS Visual Studio?

I would like dmc to be able to use functions from any windows dlls, without spending hours manually creating module definition files for hundreds of functions. I've described my problem in detail in this message:

Message-ID: <fch3dt$kb1$1@digitalmars.com>

Thanks a lot for all your help.
September 17, 2007
Default User wrote:
> On Fri, 14 Sep 2007 15:03:35 -0700, Walter Bright wrote:
> 
>> 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.
> 
> Thanks Walter,
> 
> I tried coffimplib and it always says:
> Error: missing archive signature

Sounds like you tried running it on a DLL. It's designed to be run on a .LIB file in COFF format. A DLL is not a library.

> I read that it only works with microsoft import libraries (Are these the
> .lib files that would normally come with Microsoft Visual Studio?).

They come with the Microsoft Windows SDK as well as VS.

> But I
> only have dlls that normally come with Windows and whatever files came with
> dmc; I do not have those microsoft lib files. Is there a way to get them
> without MS Visual Studio?

I think the SDK is a free download from MS.

> I would like dmc to be able to use functions from any windows dlls, without
> spending hours manually creating module definition files for hundreds of
> functions. I've described my problem in detail in this message:
> 
> Message-ID: <fch3dt$kb1$1@digitalmars.com>
> 
> Thanks a lot for all your help.

The problem is Microsoft stripped information from the dlls, so an import library cannot be automatically generated from them. What they stripped are the 'mangled' names. There is no way for a program to insert the missing mangling text, as it is different for every function signature.
September 17, 2007
On Sun, 16 Sep 2007 18:04:27 -0700, Walter Bright wrote:

> The problem is Microsoft stripped information from the dlls, so an import library cannot be automatically generated from them. What they stripped are the 'mangled' names. There is no way for a program to insert the missing mangling text, as it is different for every function signature.

So my only solution is to install SDK?

Couldn't DigitalMars just make more .lib files (to cover all Windows dll's, rather than just 18 supplied with DM)? If Digital Mars managed to create those 18, why cannot they create more, instead of having every user install SDK! I'm sure most users sooner or later need a function which is not included in those 18 libraries.

Also one can circumvent the problem manually using module definition files, without having any extra info or knowing mangling text (as described in the URL I quoted). Why cannot the same process be done automatically?
September 17, 2007
If I use Jan Kneper's version of implib (which I remamed implib_jk) as follows and ask it to make an import lib file called wsock32_dm.lib from wsock32.dll using the following command:

implib_jk /system /v /suffix /def /test /Ic:\dm\include\win32 wsock32_dm.lib wsock32.dll

I get wsock32_dm.lib to link with my program and and the following output wsock32_dm.def:

EXPORTS
   _AcceptEx@32 = AcceptEx
   _EnumProtocolsA@12 = EnumProtocolsA
   _EnumProtocolsW@12 = EnumProtocolsW
   _GetAcceptExSockaddrs@32 = GetAcceptExSockaddrs
   _GetAddressByNameA@40 = GetAddressByNameA
   _GetAddressByNameW@40 = GetAddressByNameW
   _GetNameByTypeA@12 = GetNameByTypeA
   _GetNameByTypeW@12 = GetNameByTypeW
   _GetServiceA@28 = GetServiceA
   _GetServiceW@28 = GetServiceW
   _GetTypeByNameA@8 = GetTypeByNameA
   _GetTypeByNameW@8 = GetTypeByNameW
   _MigrateWinsockConfiguration = MigrateWinsockConfiguration
   _NPLoadNameSpaces = NPLoadNameSpaces
   _SetServiceA@24 = SetServiceA
   _SetServiceW@24 = SetServiceW
   _TransmitFile@28 = TransmitFile
   _WEP = WEP
   _WSAAsyncGetHostByAddr@28 = WSAAsyncGetHostByAddr
   _WSAAsyncGetHostByName@20 = WSAAsyncGetHostByName
   _WSAAsyncGetProtoByName@20 = WSAAsyncGetProtoByName
   _WSAAsyncGetProtoByNumber@20 = WSAAsyncGetProtoByNumber
   _WSAAsyncGetServByName@24 = WSAAsyncGetServByName
   _WSAAsyncGetServByPort@24 = WSAAsyncGetServByPort
   _WSAAsyncSelect@16 = WSAAsyncSelect
   _WSACancelAsyncRequest@4 = WSACancelAsyncRequest
   _WSACancelBlockingCall@0 = WSACancelBlockingCall
   _WSACleanup@0 = WSACleanup
   _WSAGetLastError@0 = WSAGetLastError
   _WSAIsBlocking@0 = WSAIsBlocking
   _WSARecvEx@16 = WSARecvEx
   _WSASetBlockingHook@4 = WSASetBlockingHook
   _WSASetLastError@4 = WSASetLastError
   _WSAStartup@8 = WSAStartup
   _WSAUnhookBlockingHook@0 = WSAUnhookBlockingHook
   _WSApSetPostRoutine = WSApSetPostRoutine
   ___WSAFDIsSet@8 = __WSAFDIsSet
   _accept@12 = accept
   _bind@12 = bind
   _closesocket@4 = closesocket
   _connect@12 = connect
   _dn_expand = dn_expand
   _gethostbyaddr@12 = gethostbyaddr
   _gethostbyname@4 = gethostbyname
   _gethostname@8 = gethostname
   _getnetbyname = getnetbyname
   _getpeername@12 = getpeername
   _getprotobyname@4 = getprotobyname
   _getprotobynumber@4 = getprotobynumber
   _getservbyname@8 = getservbyname
   _getservbyport@8 = getservbyport
   _getsockname@12 = getsockname
   _getsockopt@20 = getsockopt
   _htonl@4 = htonl
   _htons@4 = htons
   _inet_addr@4 = inet_addr
   _inet_network = inet_network
   _inet_ntoa@4 = inet_ntoa
   _ioctlsocket@12 = ioctlsocket
   _listen@8 = listen
   _ntohl@4 = ntohl
   _ntohs@4 = ntohs
   _rcmd = rcmd
   _recv@16 = recv
   _recvfrom@24 = recvfrom
   _rexec = rexec
   _rresvport = rresvport
   _s_perror = s_perror
   _select@20 = select
   _send@16 = send
   _sendto@24 = sendto
   _sethostname = sethostname
   _setsockopt@20 = setsockopt
   _shutdown@8 = shutdown
   _socket@12 = socket
September 17, 2007
Sorry Walter, forget everyhting I've said. I didn't realize you were the developer.

Thanks for everybody's help, I've moved on to another compiler.
September 18, 2007
Default User wrote:
> Couldn't DigitalMars just make more .lib files (to cover all Windows dll's,
> rather than just 18 supplied with DM)? If Digital Mars managed to create
> those 18, why cannot they create more, instead of having every user install
> SDK! I'm sure most users sooner or later need a function which is not
> included in those 18 libraries.

Microsoft changes those libraries constantly.

> Also one can circumvent the problem manually using module definition files,
> without having any extra info or knowing mangling text (as described in the
> URL I quoted). Why cannot the same process be done automatically?

Because in the DLL will be a name like:

	AbcDef

Yet the mangled name would be something like:

	AbcDef@8

How, by looking at the DLL, can the tool automatically guess the @8? or @4? or @16?
September 18, 2007
  As I posted in the windows.32-bit forum, all you need is the DLL
and the header file and you are good to go.  I downloaded the
Windows platform SDK and started using GDI++ functions (I
needed .PNG output) by using JK's version of Implib.
  I recommend people take a look at the new MSSDK, there are a
bunch of usefull new functions and using it under DM is pretty easy.
September 21, 2007
On Mon, 17 Sep 2007 23:46:59 -0400, Walter Bright <newshound1@digitalmars.com> wrote:

>> Also one can circumvent the problem manually using module definition files, without having any extra info or knowing mangling text (as described in the URL I quoted). Why cannot the same process be done automatically?
>
> Because in the DLL will be a name like:
>
> 	AbcDef
>
> Yet the mangled name would be something like:
>
> 	AbcDef@8
>
> How, by looking at the DLL, can the tool automatically guess the @8? or @4? or @16?

While this thread ended rather rudely by Default User, it is timely
for me, as I'm having a similar problem.

I'm trying to use the Marshall Soft
Windows Serial Communication Component Library (WSC4C)
http://www.marshallsoft.com/
Free download for the evaluation version
if anyone wants to share the pain.

Following the various tips in this thread I've
created this .DEF file:

EXPORTS
   _SioBaud@8 = SioBaud
   _SioCTS@4 = SioCTS
   _SioDone@4 = SioDone
   _SioFlow@8 = SioFlow
   _SioGets@12 = SioGets
   _SioInfo@4 = SioInfo
   _SioKeyCode@4 = SioKeyCode
   _SioPutc@8 = SioPutc
   _SioReset@12 = SioReset
   _SioRxClear@4 = SioRxClear

Yet I still get link errors:

link @simple.rsp,simple,simple,wsc32dm.lib,wsc32dm.def,simple.res
OPTLINK (R) for Win32  Release 7.50B1
Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved

OPTLINK : Error 180: No Match Found for Export/ENTRY -  : SioBaud
OPTLINK : Error 180: No Match Found for Export/ENTRY -  : SioCTS
OPTLINK : Error 180: No Match Found for Export/ENTRY -  : SioDone
OPTLINK : Error 180: No Match Found for Export/ENTRY -  : SioFlow
OPTLINK : Error 180: No Match Found for Export/ENTRY -  : SioGets
OPTLINK : Error 180: No Match Found for Export/ENTRY -  : SioInfo
OPTLINK : Error 180: No Match Found for Export/ENTRY -  : SioKeyCode
OPTLINK : Error 180: No Match Found for Export/ENTRY -  : SioPutc
OPTLINK : Error 180: No Match Found for Export/ENTRY -  : SioReset
OPTLINK : Error 180: No Match Found for Export/ENTRY -  : SioRxClear
OPTLINK : Error 129: WeakLazyAlias Internal : SioDone

--- errorlevel 11

This is the Makefile I created to build the WSC 'simple' example,
converted from a BCC55 Makefile.


#
# Digital Mars makefile for SIMPLE [Win32]
#
# NOTE: Response file (simple.rsp) must NOT end with a carriage return, line feed.
#
# To use: "make -f simple32._d_"
#

CCFLAGS = -c -DWIN32

simple.exe: simple.res simple.obj wsc32dm.def wsc32dm.lib about.obj line.obj paint.obj sioerror.obj
	link @simple.rsp,simple,simple,wsc32dm.lib,wsc32dm.def,simple.res

about.obj: about.c about.h
   dmc $(CCFLAGS)  about.c

simple.obj: simple.c simple.h wsc.h
   dmc $(CCFLAGS)  simple.c

sioerror.obj: sioerror.c sioerror.h wsc.h
   dmc $(CCFLAGS)  sioerror.c

paint.obj: paint.c paint.h
   dmc $(CCFLAGS)  paint.c

line.obj: line.c line.h wsc.h
   dmc $(CCFLAGS)  line.c

simple.res: simple.rc
    rcc -dWIN32 -D__NT__ simple.rc
# Why did I need to add the -D__NT__?

wsc32dm.lib:
	implib_jk /system /v /suffix /def /test /IG:\DM\include\win32 wsc32dm.lib wsc32.dll


September 22, 2007
Bob Paddock wrote:
> While this thread ended rather rudely by Default User, it is timely
> for me, as I'm having a similar problem.
> 
> I'm trying to use the Marshall Soft
> Windows Serial Communication Component Library (WSC4C)
> http://www.marshallsoft.com/
> Free download for the evaluation version
> if anyone wants to share the pain.
> 
> Following the various tips in this thread I've
> created this .DEF file:
> 
> EXPORTS
>    _SioBaud@8 = SioBaud
>    _SioCTS@4 = SioCTS
>    _SioDone@4 = SioDone
>    _SioFlow@8 = SioFlow
>    _SioGets@12 = SioGets
>    _SioInfo@4 = SioInfo
>    _SioKeyCode@4 = SioKeyCode
>    _SioPutc@8 = SioPutc
>    _SioReset@12 = SioReset
>    _SioRxClear@4 = SioRxClear
> 
> Yet I still get link errors:
> 
> link @simple.rsp,simple,simple,wsc32dm.lib,wsc32dm.def,simple.res
> OPTLINK (R) for Win32  Release 7.50B1
> Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved
> 
> OPTLINK : Error 180: No Match Found for Export/ENTRY -  : SioBaud
> OPTLINK : Error 180: No Match Found for Export/ENTRY -  : SioCTS
> OPTLINK : Error 180: No Match Found for Export/ENTRY -  : SioDone
> OPTLINK : Error 180: No Match Found for Export/ENTRY -  : SioFlow
> OPTLINK : Error 180: No Match Found for Export/ENTRY -  : SioGets
> OPTLINK : Error 180: No Match Found for Export/ENTRY -  : SioInfo
> OPTLINK : Error 180: No Match Found for Export/ENTRY -  : SioKeyCode
> OPTLINK : Error 180: No Match Found for Export/ENTRY -  : SioPutc
> OPTLINK : Error 180: No Match Found for Export/ENTRY -  : SioReset
> OPTLINK : Error 180: No Match Found for Export/ENTRY -  : SioRxClear
> OPTLINK : Error 129: WeakLazyAlias Internal : SioDone
> 
> --- errorlevel 11

That likely means that your import library, wsc32dm.lib, does not contain those names. I'd check it with a file dumper.
September 24, 2007
I posted how I used Jan Knepper's version of Implib.exe to imp- lement the latest GDI+ from the MSSDK over at 'c++.windows.32- bits'.  It will probably work for you as well.

Get the program at http://www.digitalmars.com/~jan/

Create an import lib using the program as follows:
 implib_jk /system /v /suffix /def /test /I. ***.lib
***.dll

Be sure you provide the path to all the header files.

The resulting ***.lib can then be linked into your project. A files titled "***.cpp" was also created, may be useful.