1

I'm trying to compile a 16-bit Windows DLL for this for this question on the reverseengineering stackexchange.

Below is my absolute minimum source files:

mydll.c

int main (int reason) {
  return 0;
}

mydll.lnk

FORMAT WINDOWS DLL

LIBPATH .\openwatcom\lib286
LIBPATH .\openwatcom\lib286\win

LIBRARY windows

FILE mydll.obj
NAME mydll

I'm them using the following two commands to compile and link the DLL.

# Build
openwatcom\binnt\wcc.exe -i='openwatcom\h;openwatcom\h\win' -bd -w4 -d2 -zu -bt=windows -fo=.obj -ml mydll.c

# Link
openwatcom\binnt\wlink.exe @mydll.lnk

But for some reason the linking steps fails with the following messages:

Error! E2028: __DLLstart_ is an undefined reference
Error! E2028: __fpmath is an undefined reference
creating a Windows dynamic link library
file clibl.lib(sigfpe.c): undefined symbol __fpmath

My goal is just to be able to build a 16 bit DLL file, preferably from wine on my Mac, but I also have a Windows XP virtual machine so that's acceptable as well.

Linus Unnebäck
  • 23,234
  • 15
  • 74
  • 89
  • A DLL isn't a normal executable file, and as such it doesn't have a `main` function, since there is no real execution starting point. I suggest you put in e.g. `DLLstart` in your favorite search engine and do some research about the missing symbols. – Some programmer dude Nov 08 '17 at 16:32
  • Yeah that's what I thought as well, but for some reason it complained about `Error! E2028: LIBMAIN is an undefined reference` missing until I added a `main` function that took exactly one int as a parameter. I think it has something to do with the function that gets called when the DLL is loaded, but I'm not 100% sure about that... – Linus Unnebäck Nov 08 '17 at 16:58

0 Answers0