Thread overview
has anyone got the OpenWatcom (wlink) linker to work (in windows)?
Aug 29, 2004
Roald Ribe
Aug 30, 2004
Ilya Minkov
Aug 31, 2004
Christof Meerwald
Sep 10, 2004
Christof Meerwald
August 29, 2004
i've got some free time in the past few days, so i've been messing with the Open Watcom multi-format linker.  i'm trying to link some COFF-format files in with my project.

i'm just having trouble getting the damn thing to link correctly, period, let alone link in other formats.  i'm using a very simple program:

[dtest.d]
import std.stdio;

void main()
{
    int x=5;
    writefln(x);
}

and i'm compiling with the -c flag so it doesn't use the OPTLINK linker.

i then link with the following command (for those not familiar with DOS, %var% is the same as $(var))

set LINK=\dmd\bin\wlink
set PROG=dtest
%LINK% LIBP \dmd\lib LIBP \dm\lib FORM WIndows F %PROG%.obj LIBF kernel32.lib N %PROG%

i have to use the LIBF kernel32.lib or else it gives a lot of undefined references.

the weird thing is that it compiles and links just fine, but the final EXE is unrunnable.  i run it and it gives a cryptic message about something called BaseAttachCompleteThunk not being found in kernel32.dll.

has anyone had any better luck with this?  most of the options in the linker are way over my head, and i have no idea what i'm missing.

again i lament - WHY OH WHY COULDN'T WALTER JUST USE COFF ;)

August 29, 2004
When using wlink for C and WIN32 linking, you make a .lnk file looking somthing like this:

OP STACK=128k
FILE prog.obj
NAME prog.exe
SYS NT_WIN
RU CON
LIBRARY kernel32.lib

I think I have seen a web page for DMC/DMD and wlink interaction. Maybe it contains a howto?

Roald


"Jarrett Billingsley" <kb3ctd2@yahoo.com> wrote in message
news:cgres8$103m$1@digitaldaemon.com...
i've got some free time in the past few days, so i've been messing with the
Open Watcom multi-format linker.  i'm trying to link some COFF-format files
in with my project.

i'm just having trouble getting the damn thing to link correctly, period, let alone link in other formats.  i'm using a very simple program:

[dtest.d]
import std.stdio;

void main()
{
    int x=5;
    writefln(x);
}

and i'm compiling with the -c flag so it doesn't use the OPTLINK linker.

i then link with the following command (for those not familiar with DOS,
%var% is the same as $(var))

set LINK=\dmd\bin\wlink
set PROG=dtest
%LINK% LIBP \dmd\lib LIBP \dm\lib FORM WIndows F %PROG%.obj LIBF
kernel32.lib N %PROG%

i have to use the LIBF kernel32.lib or else it gives a lot of undefined references.

the weird thing is that it compiles and links just fine, but the final EXE is unrunnable.  i run it and it gives a cryptic message about something called BaseAttachCompleteThunk not being found in kernel32.dll.

has anyone had any better luck with this?  most of the options in the linker are way over my head, and i have no idea what i'm missing.

again i lament - WHY OH WHY COULDN'T WALTER JUST USE COFF ;)


August 30, 2004
Do you use the original OpenWatcom linker or this one here?

http://cmeerw.org/prog/owtools/

I guess you can ask your questions to the author of the port, see bottom of the page for his e-mail afress.

-eye

Jarrett Billingsley schrieb:
> i've got some free time in the past few days, so i've been messing with the Open Watcom multi-format linker.  i'm trying to link some COFF-format files in with my project.
>  i'm just having trouble getting the damn thing to link correctly, period, let alone link in other formats.  i'm using a very simple program:
>  [dtest.d]
> import std.stdio;
>  void main()
> {
>     int x=5;
>     writefln(x);
> }
>  and i'm compiling with the -c flag so it doesn't use the OPTLINK linker.
>  i then link with the following command (for those not familiar with DOS, %var% is the same as $(var))
>  set LINK=\dmd\bin\wlink
> set PROG=dtest
> %LINK% LIBP \dmd\lib LIBP \dm\lib FORM WIndows F %PROG%.obj LIBF kernel32.lib N %PROG%
>  i have to use the LIBF kernel32.lib or else it gives a lot of undefined references.
>  the weird thing is that it compiles and links just fine, but the final EXE is unrunnable.  i run it and it gives a cryptic message about something called BaseAttachCompleteThunk not being found in kernel32.dll.  has anyone had any better luck with this?  most of the options in the linker are way over my head, and i have no idea what i'm missing.
>  again i lament - WHY OH WHY COULDN'T WALTER JUST USE COFF ;)
August 31, 2004
yeah, i'm using christof's.  i suppose emailing him would be the best idea ;)


August 31, 2004
On Sat, 28 Aug 2004 22:27:59 -0400, Jarrett Billingsley wrote:
> [dtest.d]
> import std.stdio;
>
> void main()
> {
>     int x=3D5;
>     writefln(x);
> }

BTW, I can correctly link your example with the following command line:

  wlink libpath 'c:\programme\microsoft sdk\lib' libpath \dmd\lib libpath
  \dm\lib file test.obj format windows nt

I am not sure, but there might be an issue with using DM's OMF Win32 import libraries with wlink. Try using the Platform SDK's COFF import libraries instead.


bye, Christof

-- 
http://cmeerw.org                                 JID: cmeerw@jabber.at mailto cmeerw at web.de

...and what have you contributed to the Net?
September 02, 2004
>   wlink libpath 'c:\programme\microsoft sdk\lib' libpath \dmd\lib libpath
>   \dm\lib file test.obj format windows nt

doesn't work for me (of course i changed the path to where i have the platform SDK import libs).  i get a bunch of undefined references to functions that exist in kernel32.lib.  and if i use LIBF kernel32.lib, it compiles, but once again i get the error.


September 10, 2004
On Thu, 2 Sep 2004 16:23:20 -0400, Jarrett Billingsley wrote:
>>   wlink libpath 'c:\programme\microsoft sdk\lib' libpath \dmd\lib libpath
>>   \dm\lib file test.obj format windows nt
> doesn't work for me (of course i changed the path to where i have the platform SDK import libs).  i get a bunch of undefined references to

Hmm, what happens if you temporarily rename the kernel32.lib in \dm\lib?

And what happens if you copy the MS SDK kernel32.lib to \dm\lib?


bye, Christof

-- 
http://cmeerw.org                                 JID: cmeerw@jabber.at mailto cmeerw at web.de

...and what have you contributed to the Net?
September 12, 2004
> Hmm, what happens if you temporarily rename the kernel32.lib in \dm\lib? And what happens if you copy the MS SDK kernel32.lib to \dm\lib?

strangely enough, it works!

what makes it work, though?  it works whether the MS SDK version of kernel32 is in dm\lib or not.

thanks anyway!  hopefully i'm on my way to getting some other libs working correctly :)