www.digitalmars.com         C & C++   DMDScript  

D - linking

reply Jesse Rudolph <Jesse_member pathlink.com> writes:
hey,

im having a really hard time linking anything successfully other than what dmd
links in automatically. ive downloaded Pavel's winsock header, im importing it
and compiling the d module (my own) to object code.. then when i link it with
ws2_32.lib, from the package the winsock header is in, i still get:

"C:\dmd\bin\dmd.exe" first.d -L ws2_32.lib



C:\dmd\bin\..\..\dm\bin\link.exe first,,,ws2_32.lib+user32+kernel32/noi;

OPTLINK (R) for Win32  Release 7.50B1
Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved

first.obj(first) 


I trust its very possible, and im just doing something stupid, could someone 
please tell what, if anything, im doing wrong, and what i should be doing?

Thanks,

jesse
May 23 2003
parent reply "Walter" <walter digitalmars.com> writes:
Is _recv 16 in your ws2_32.lib? You can find out using grep or running lib
on it and generating a .lst file.

"Jesse Rudolph" <Jesse_member pathlink.com> wrote in message
news:bam1dl$9u1$1 digitaldaemon.com...
 hey,

 im having a really hard time linking anything successfully other than what
dmd
 links in automatically. ive downloaded Pavel's winsock header, im
importing it
 and compiling the d module (my own) to object code.. then when i link it
with
 ws2_32.lib, from the package the winsock header is in, i still get:

 "C:\dmd\bin\dmd.exe" first.d -L ws2_32.lib



 C:\dmd\bin\..\..\dm\bin\link.exe first,,,ws2_32.lib+user32+kernel32/noi;

 OPTLINK (R) for Win32  Release 7.50B1
 Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved

 first.obj(first)


 I trust its very possible, and im just doing something stupid, could
someone
 please tell what, if anything, im doing wrong, and what i should be doing?

 Thanks,

 jesse
May 23 2003
parent reply Jesse Rudolph <Jesse_member pathlink.com> writes:
yeah, its in there.

Jesse


In article <bamhg8$pcv$1 digitaldaemon.com>, Walter says...
Is _recv 16 in your ws2_32.lib? You can find out using grep or running lib
on it and generating a .lst file.

"Jesse Rudolph" <Jesse_member pathlink.com> wrote in message
news:bam1dl$9u1$1 digitaldaemon.com...
 hey,

 im having a really hard time linking anything successfully other than what
dmd
 links in automatically. ive downloaded Pavel's winsock header, im
importing it
 and compiling the d module (my own) to object code.. then when i link it
with
 ws2_32.lib, from the package the winsock header is in, i still get:

 "C:\dmd\bin\dmd.exe" first.d -L ws2_32.lib



 C:\dmd\bin\..\..\dm\bin\link.exe first,,,ws2_32.lib+user32+kernel32/noi;

 OPTLINK (R) for Win32  Release 7.50B1
 Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved

 first.obj(first)


 I trust its very possible, and im just doing something stupid, could
someone
 please tell what, if anything, im doing wrong, and what i should be doing?

 Thanks,

 jesse
May 23 2003
parent reply "Walter" <walter digitalmars.com> writes:
Try putting the lib file in your current directory.

"Jesse Rudolph" <Jesse_member pathlink.com> wrote in message
news:bamnoi$utl$1 digitaldaemon.com...
 yeah, its in there.

 Jesse


 In article <bamhg8$pcv$1 digitaldaemon.com>, Walter says...
Is _recv 16 in your ws2_32.lib? You can find out using grep or running
lib
on it and generating a .lst file.

"Jesse Rudolph" <Jesse_member pathlink.com> wrote in message
news:bam1dl$9u1$1 digitaldaemon.com...
 hey,

 im having a really hard time linking anything successfully other than
what
dmd
 links in automatically. ive downloaded Pavel's winsock header, im
importing it
 and compiling the d module (my own) to object code.. then when i link
it
with
 ws2_32.lib, from the package the winsock header is in, i still get:

 "C:\dmd\bin\dmd.exe" first.d -L ws2_32.lib



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

 first.obj(first)


 I trust its very possible, and im just doing something stupid, could
someone
 please tell what, if anything, im doing wrong, and what i should be
doing?
 Thanks,

 jesse
May 23 2003
parent reply Jesse <Jesse_member pathlink.com> writes:
i removed it from the dmc lib folder, and from the dmd lib folder, put it in my
project directory, and got the same thing, i made a new copy with implib
too(stab in the dark). also, it is generating an executable, even when the
linker gives me that error, dunno if thats normal or not. i read something about
not linking unreferenced code somewhere else on the board, maybe its something
to do with that.. because the lib is 13k, and the executable produced is the
same size with and without me linking in the lib. only other linker i have is
borland c++ 5.5's and its not a proper substitution, from it i get:

C:\d\projects\myfirstd>dmd first.d ws2_32.lib
c:\dmd\bin\..\..\borland\bcc55\bin\ilink32.exe first,,,ws2_32.lib+user32+kernel3
2/noi;
Turbo Incremental Link 5.00 Copyright (c) 1997, 2000 Borland
Fatal: Illegal EXTDEF fixup index in module 'first.d'
--- errorlevel 2

which probably is expected, or atleast acceptable behavior.
In article <bamvps$168l$1 digitaldaemon.com>, Walter says...
Try putting the lib file in your current directory.
May 24 2003
parent reply Jesse <Jesse_member pathlink.com> writes:
wait wait, its in the lib output, but not as _recv 16, its just recv, is this
wrong? and how would i make use if this?

article <ban5ke$1ccu$1 digitaldaemon.com>, Jesse says...
i removed it from the dmc lib folder, and from the dmd lib folder, put it in my
project directory, and got the same thing, i made a new copy with implib
too(stab in the dark). also, it is generating an executable, even when the
linker gives me that error, dunno if thats normal or not. i read something about
not linking unreferenced code somewhere else on the board, maybe its something
to do with that.. because the lib is 13k, and the executable produced is the
same size with and without me linking in the lib. only other linker i have is
borland c++ 5.5's and its not a proper substitution, from it i get:

C:\d\projects\myfirstd>dmd first.d ws2_32.lib
c:\dmd\bin\..\..\borland\bcc55\bin\ilink32.exe first,,,ws2_32.lib+user32+kernel3
2/noi;
Turbo Incremental Link 5.00 Copyright (c) 1997, 2000 Borland
Fatal: Illegal EXTDEF fixup index in module 'first.d'
--- errorlevel 2

which probably is expected, or atleast acceptable behavior.
In article <bamvps$168l$1 digitaldaemon.com>, Walter says...
Try putting the lib file in your current directory.
May 24 2003
parent reply "Walter" <walter digitalmars.com> writes:
"Jesse" <Jesse_member pathlink.com> wrote in message
news:ban6hr$1d7c$1 digitaldaemon.com...
 wait wait, its in the lib output, but not as _recv 16, its just recv, is
this
 wrong?
Yes, it is wrong. The names have to match exactly.
 and how would i make use if this?
The calling conventions used on the function affect the name, and so are different.
May 24 2003
parent reply Jesse Rudolph <Jesse_member pathlink.com> writes:
I understand, but these arent mangled, and D defaults to its own calling
convention. I guess ill need to wrap it and write my own lib then right? its an
asm calling convention i think, and D doesnt support that, that i know of.

In article <ban7k7$1e36$1 digitaldaemon.com>, Walter says...
"Jesse" <Jesse_member pathlink.com> wrote in message
news:ban6hr$1d7c$1 digitaldaemon.com...
 wait wait, its in the lib output, but not as _recv 16, its just recv, is
this
 wrong?
Yes, it is wrong. The names have to match exactly.
 and how would i make use if this?
The calling conventions used on the function affect the name, and so are different.
May 24 2003
parent "Walter" <walter digitalmars.com> writes:
The  16 calling convention is __stdcall for C, and extern (Windows) for D.

"Jesse Rudolph" <Jesse_member pathlink.com> wrote in message
news:bana24$1it8$1 digitaldaemon.com...
 I understand, but these arent mangled, and D defaults to its own calling
 convention. I guess ill need to wrap it and write my own lib then right?
its an
 asm calling convention i think, and D doesnt support that, that i know of.

 In article <ban7k7$1e36$1 digitaldaemon.com>, Walter says...
"Jesse" <Jesse_member pathlink.com> wrote in message
news:ban6hr$1d7c$1 digitaldaemon.com...
 wait wait, its in the lib output, but not as _recv 16, its just recv,
is
this
 wrong?
Yes, it is wrong. The names have to match exactly.
 and how would i make use if this?
The calling conventions used on the function affect the name, and so are different.
May 24 2003