February 19, 2002
Hi

I'm trying to building an import library for wsock32.lib so that I can use that when linking my myown.dll, but I keep getting errors like

link /CO /NOI /DO /DE /NOPACKF /XN /NT /ENTRY:_DllMainCRTStartup
/BAS:268435456 /A:512 /IMPL:.\$SCW$.LIB @OMApiDll.LNK
... (1230568): Symbol Undefined _recv@16
... (1230568): Symbol Undefined _send@16
... (1230728): Symbol Undefined _closesocket@4
... (1230728): Symbol Undefined _connect@12
... (1230568): Symbol Undefined _htons@4
... (1230568): Symbol Undefined _socket@12
...  (1230724): Symbol Undefined _gethostbyname@4
...  (1230728): Symbol Undefined _gethostname@8
...  (1230728): Symbol Undefined _WSAStartup@8
Errors: 9  Warnings: 0
Build failed

I'm using the flags '-mn -WA -WD' when compiling.

I've tried to build it like 'implib /s wsock32.lib \winnt\system32\wsock32.dll' but I still get errors.

So I've tried to create it using a wsock32.def file with following contents.
LIBRARY wsock32
EXETYPE NT
SUBSYSTEM WINDOWS

EXPORTS
    _WSAStartup                   = WSAStartup@8                          ;
WSAStartup
    _closesocket                  = closesocket@4                        ;
closesocket
    _connect                      = connect@12                             ;
connect
    _gethostbyname                = gethostbyname@4                       ;
gethostbyname
    _gethostname                  = gethostname@8                         ;
gethostname
    _htons                        = htons@4                               ;
htons
    _recv                         = recv@16                                ;
recv
    _send                         = send@16                                ;
send
    _socket                       = socket@12                              ;
socket

The library gets built but I still get the same errors build linking my dll.
implib /s wsock32.lib wsock32.def
Digital Mars Import Library Manager Version 7.6B1n
Copyright (C) Digital Mars 2000.  All Rights Reserved.
Output is a Windows NT import library.
Digital Mars Import Library Creator complete.

Can anyone tell what I'm doing wrong, if you provide an example, please provide a working example. I've already skimmed the newsgroup for example, both this one and borland.public...

Regards
- Ingvaldur



February 19, 2002
Hi all,

Just because of a 'hunch' I moved the @n from the second exports column to the first, and voila, it worked...

But I'm sure I need to have more functions that listed in the .def, so I would really like to have a more 'convenient' way of building a 'import'.lib from a Windows NT dll.

There should have been one on the FAQ but I didn't find it !

regards
- Ingvaldur

"Ingvaldur Sigurjonsson" <ingi@ementor.se> wrote in message news:a4tosn$4hi$1@digitaldaemon.com...
> Hi
>
> I'm trying to building an import library for wsock32.lib so that I can use that when linking my myown.dll, but I keep getting errors like
>
> link /CO /NOI /DO /DE /NOPACKF /XN /NT /ENTRY:_DllMainCRTStartup
> /BAS:268435456 /A:512 /IMPL:.\$SCW$.LIB @OMApiDll.LNK
> ... (1230568): Symbol Undefined _recv@16
> ... (1230568): Symbol Undefined _send@16
> ... (1230728): Symbol Undefined _closesocket@4
> ... (1230728): Symbol Undefined _connect@12
> ... (1230568): Symbol Undefined _htons@4
> ... (1230568): Symbol Undefined _socket@12
> ...  (1230724): Symbol Undefined _gethostbyname@4
> ...  (1230728): Symbol Undefined _gethostname@8
> ...  (1230728): Symbol Undefined _WSAStartup@8
> Errors: 9  Warnings: 0
> Build failed
>
> I'm using the flags '-mn -WA -WD' when compiling.
>
> I've tried to build it like 'implib /s wsock32.lib \winnt\system32\wsock32.dll' but I still get errors.
>
> So I've tried to create it using a wsock32.def file with following
contents.
> LIBRARY wsock32
> EXETYPE NT
> SUBSYSTEM WINDOWS
>
> EXPORTS
>     _WSAStartup                   = WSAStartup@8
;
> WSAStartup
>     _closesocket                  = closesocket@4                        ;
> closesocket
>     _connect                      = connect@12
;
> connect
>     _gethostbyname                = gethostbyname@4
;
> gethostbyname
>     _gethostname                  = gethostname@8
;
> gethostname
>     _htons                        = htons@4
;
> htons
>     _recv                         = recv@16
;
> recv
>     _send                         = send@16
;
> send
>     _socket                       = socket@12
;
> socket
>
> The library gets built but I still get the same errors build linking my
dll.
> implib /s wsock32.lib wsock32.def
> Digital Mars Import Library Manager Version 7.6B1n
> Copyright (C) Digital Mars 2000.  All Rights Reserved.
> Output is a Windows NT import library.
> Digital Mars Import Library Creator complete.
>
> Can anyone tell what I'm doing wrong, if you provide an example, please provide a working example. I've already skimmed the newsgroup for example, both this one and borland.public...
>
> Regards
> - Ingvaldur
>
>
>