Thread overview
pragma(lib,...)
Mar 13, 2006
Lionello Lunesu
Mar 14, 2006
Lionello Lunesu
Mar 14, 2006
jicman
Mar 14, 2006
Lionello Lunesu
Mar 15, 2006
Derek Parnell
March 13, 2006
Hi,

I'm having some problems with "pragma(lib,..)". I have a 1 module D program, main.d, to test a socket connection. It imports std.socket, whcih used to work just fine, without the need to provide a lib. With DMD 0.149 however (don't know when this issue was introduced) it won't find the winsock imports:

 D:\llunesu>dmd main
 C:\dmd\bin\..\..\dm\bin\link.exe main,,,user32+kernel32/noi;
 OPTLINK (R) for Win32  Release 7.50B1
 Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved

 C:\dmd\bin\..\lib\phobos.lib(socket)
  Error 42: Symbol Undefined _getprotobyname@4
<and many more>

When I provide the lib name on the command line it works fine:

 D:\llunesu>dmd main WSOCK32.LIB
 C:\dmd\bin\..\..\dm\bin\link.exe main,,,WSOCK32.LIB+user32+kernel32/noi;

But when I specifiy pragma(lib,"WSOCK32.LIB") (which works just fine in other projects) I get:

 D:\llunesu>dmd main
 C:\dmd\bin\..\..\dm\bin\link.exe main,,,user32+kernel32/noi;
 OPTLINK (R) for Win32  Release 7.50B1
 Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved

OPTLINK : Warning 23: No Stack
main.obj(main)
 Error 42: Symbol Undefined __init_11TypeInfo_Aa
main.obj(main)
 Error 42: Symbol Undefined __nullext
main.obj(main)
 Error 42: Symbol Undefined __ModuleInfo_3std5stdio
main.obj(main)
 Error 42: Symbol Undefined __ModuleInfo_3std7cstream
main.obj(main)
 Error 42: Symbol Undefined __ModuleInfo_3std6socket
OPTLINK : Warning 134: No Start Address
--- errorlevel 5


Any idea?

L.


March 13, 2006
"Lionello Lunesu" <lio@remove.lunesu.com> wrote in message news:dv439r$2urg$1@digitaldaemon.com...
> When I provide the lib name on the command line it works fine:

Are you putting the pragma in main.d, or just in an imported module that doesn't get compiled?


March 14, 2006
Use build? :-)

Lionello Lunesu says...
>
>Hi,
>
>I'm having some problems with "pragma(lib,..)". I have a 1 module D program, main.d, to test a socket connection. It imports std.socket, whcih used to work just fine, without the need to provide a lib. With DMD 0.149 however (don't know when this issue was introduced) it won't find the winsock imports:
>
> D:\llunesu>dmd main
> C:\dmd\bin\..\..\dm\bin\link.exe main,,,user32+kernel32/noi;
> OPTLINK (R) for Win32  Release 7.50B1
> Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved
>
> C:\dmd\bin\..\lib\phobos.lib(socket)
>  Error 42: Symbol Undefined _getprotobyname@4
><and many more>
>
>When I provide the lib name on the command line it works fine:
>
> D:\llunesu>dmd main WSOCK32.LIB
> C:\dmd\bin\..\..\dm\bin\link.exe main,,,WSOCK32.LIB+user32+kernel32/noi;
>
>But when I specifiy pragma(lib,"WSOCK32.LIB") (which works just fine in other projects) I get:
>
> D:\llunesu>dmd main
> C:\dmd\bin\..\..\dm\bin\link.exe main,,,user32+kernel32/noi;
> OPTLINK (R) for Win32  Release 7.50B1
> Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved
>
>OPTLINK : Warning 23: No Stack
>main.obj(main)
> Error 42: Symbol Undefined __init_11TypeInfo_Aa
>main.obj(main)
> Error 42: Symbol Undefined __nullext
>main.obj(main)
> Error 42: Symbol Undefined __ModuleInfo_3std5stdio
>main.obj(main)
> Error 42: Symbol Undefined __ModuleInfo_3std7cstream
>main.obj(main)
> Error 42: Symbol Undefined __ModuleInfo_3std6socket
>OPTLINK : Warning 134: No Start Address
>--- errorlevel 5
>
>
>Any idea?
>
>L.
>
>


March 14, 2006
"jicman" <jicman_member@pathlink.com> wrote in message news:dv55d8$1had$1@digitaldaemon.com...
>
> Use build? :-)

??? I get the same linker output if I use build. Futhermore, I have to manually delete main.obj after each try, since "Files are up to date, no build required." (eventhough the previous builds had linker errors).

OPTLINK is still creating an .exe, apparently..

L.


March 14, 2006
> Are you putting the pragma in main.d, or just in an imported module that doesn't get compiled?

In main.d, right after the imports. I only import std.stdio and std.socket..

L.


March 15, 2006
In article <dv5qv3$296q$1@digitaldaemon.com>, Lionello Lunesu says...
>
>
>"jicman" <jicman_member@pathlink.com> wrote in message news:dv55d8$1had$1@digitaldaemon.com...
>>
>> Use build? :-)
>
>??? I get the same linker output if I use build. Futhermore, I have to manually delete main.obj after each try, since "Files are up to date, no build required." (eventhough the previous builds had linker errors).
>
>OPTLINK is still creating an .exe, apparently..
>

Try using Build again but with ...

version(build) pragma(link, "wsock32.lib");

and use the -full switch to force a full recompile.