Fabian T
Fabian T

Reputation: 17

wlink to create an executable from obj files and libraries

I got the newest version of WATCOMs wlink from github (V2.0 29.04.2024, https://github.com/open-watcom/open-watcom-v2) and djgpp-mingw-gcc1220-standalone from github too (https://github.com/andrewwutw/build-djgpp).

So I tried to compile this code (test.c) :

#include <stdio.h>
int main(){
  printf("\n");
  return 0;
}

By the following command:

gcc test.c -w -freestanding -c -o test.o

Then I wanted to create an executable from that test.o file by using wlink

So I did that:

wlink file test.o file lib/libmsvcrt.a

(libmsvcrt.a is a library I got from mingw which provides printf function as far as I know)

Executing these commands does not output any exceptions, but no executable has been created by wlink. Wlink prints this:

Open Watcom Linker...
Copyright...
Portions Copyright...
Source code is available under...
See https://github...
loading object files

Thats it, no errors. If I do the same but with this code (another version of test.c):

int main(){
  return 0;
}

and the same steps, but

wlink file test.o

It works fine and test.exe is been generated. So it seems that the .a libraries here is the problem. How can i fix it?

This is just a minimal example, the real project is much bigger, so i think getting all the object files from that .a file via

ar xv libmsvcrt.a 

And searching for all .o files of all the standard c functions I am using and including them while linking by hand doesn't seem right to me, even though this could work if I put a lot of time and effort into it.

Upvotes: 1

Views: 130

Answers (0)

Related Questions