User forums > Help
How to set up 16-bit DOS Open Watcom target linking?
Alpha:
--- Code: (src/plugins/compilergcc/directcommands.cpp) ---wxArrayString DirectCommands::GetTargetLinkCommands(ProjectBuildTarget* target, bool force) const
{
[...]
bool IsOpenWatcom = target->GetCompilerID().IsSameAs(_T("ow"));
[...]
if (IsOpenWatcom && target->GetTargetType() != ttStaticLib)
linkfiles << _T("file ");
[...]
--- End code ---
This does not look good...
stahta01:
I agree that does NOT look good.
Tim S.
PS: Now I think I might understand the first post, better.
--- Quote from: Alpha on October 10, 2014, 07:37:33 pm ---
--- Code: (src/plugins/compilergcc/directcommands.cpp) ---wxArrayString DirectCommands::GetTargetLinkCommands(ProjectBuildTarget* target, bool force) const
{
[...]
bool IsOpenWatcom = target->GetCompilerID().IsSameAs(_T("ow"));
[...]
if (IsOpenWatcom && target->GetTargetType() != ttStaticLib)
linkfiles << _T("file ");
[...]
--- End code ---
This does not look good...
--- End quote ---
ta0:
--- Quote from: Alpha on October 10, 2014, 07:37:33 pm --- if (IsOpenWatcom && target->GetTargetType() != ttStaticLib)
linkfiles << _T("file ");
--- End quote ---
Lol, that's a hack if I ever saw one :)
Anyway, for anybody having the same problem and arriving here by way of google, here's the very simple and straight forward work-around for people wanting to use OW to build for 16-bit DOS:
Copy the OpenWatcom (W32) Compiler target config to a new one, let's call it OpenWatcom DOS16.
In Settings>Compiler>Global compiler settings> [select OpenWatcom DOS16 as Selected compiler] > Other Settings>Advanced options...>Commands>Command:Link object files to console executable:
$linker option quiet form DOS $link_options $libdirs file $link_objects name $exe_output $libs $link_resobjects
and in Others>Object separator, make sure it is a simple comma (","). (So, we're adding form DOS to make sure wlink.exe builds a DOS .EXE, and file in front of $link_objects because that's how wlink.exe wants it)
Repeat similarily for the other types of Command: commands (Link object files to dynamic library, static... etc).
Then change the Settings>Compiler>Global compiler settings>Toolchain executables to:
C compiler: wcl.exe
C++ compiler: wcl.exe
You will also need the following in Settings>Compiler>Global compiler settings>Search directories
Compiler:
c:\watcom\h
Linker:
c:\watcom\lib386
c:\watcom\lib386\dos
c:\watcom\lib286
c:\watcom\lib286\dos
Resource compiler:
c:\watcom\h
In Settings>Compiler>Global compiler settings>Build options
Number of parallel builds: 1
(otherwise the linker will fail because it can only run one instance at a time)
Further, I'd use 8.3 compliant paths and file names for less frustration potential.
This is in the general case, you might of course need other files for the linker and include directories depending on your project.
So, the only problem with copying the OpenWatcom (W32) Compiler target is that the magic behavior of the file directive is not carried over, for obvious reasons. In fact, this is not really a work around at all, because the magic behavior for (W32) is completely unnecessary; it could be handled by the regular target options.
I'm running Code::Blocks 13.12 in Windows XP, and "Open Watcom C x86 16-bit Optimizing Compiler
Version 2.0 beta Apr 27 2014 22:29:25", that is the v2 fork by Jiri Malak. I have not actually tried anything else than building a very basic multi source file DOS16 console app, and I suspect that dynamic libraries etc will actually need further tweaks in Advanced options... to build. Of course the above only applies exactly like this if you have installed the OpenWatcom compiler into c:\watcom, and selected to install the DOS compiler components when running the OpenWatcom installation program.
stahta01:
Possible patch that needs tested by a person using Open Watcom.
--- Code: ---Index: src/plugins/compilergcc/directcommands.cpp
===================================================================
--- src/plugins/compilergcc/directcommands.cpp (revision 9936)
+++ src/plugins/compilergcc/directcommands.cpp (working copy)
@@ -677,8 +677,6 @@
ret.Add(wxString(COMPILER_SIMPLE_LOG) + _("Linking stage skipped (build target has no object files to link)"));
return ret;
}
- if (IsOpenWatcom && target->GetTargetType() != ttStaticLib)
- linkfiles << _T("file ");
bool subseq(false);
for (unsigned int i = 0; i < files.GetCount(); ++i)
{
Index: src/plugins/compilergcc/resources/compilers/options_ow.xml
===================================================================
--- src/plugins/compilergcc/resources/compilers/options_ow.xml (revision 9936)
+++ src/plugins/compilergcc/resources/compilers/options_ow.xml (working copy)
@@ -436,15 +436,15 @@
<Command name="CompileResource"
value="$rescomp -q -r -fo=$resource_output $res_includes $file"/>
<Command name="LinkExe"
- value="$linker option quiet $link_options $libdirs $link_objects name $exe_output $libs $link_resobjects"/>
+ value="$linker option quiet $link_options $libdirs file $link_objects name $exe_output $libs $link_resobjects"/>
<Command name="LinkConsoleExe"
- value="$linker option quiet $link_options $libdirs $link_objects name $exe_output $libs $link_resobjects"/>
+ value="$linker option quiet $link_options $libdirs file $link_objects name $exe_output $libs $link_resobjects"/>
<Command name="LinkDynamic"
- value="$linker option quiet $link_options $libdirs name $exe_output $libs $link_objects"/>
+ value="$linker option quiet $link_options $libdirs name $exe_output $libs file $link_objects"/>
<Command name="LinkStatic"
value="$lib_linker -q $static_output $link_objects"/>
<Command name="LinkNative"
- value="$linker option quiet $link_options $libdirs $link_objects name $exe_output $libs $link_resobjects"/>
+ value="$linker option quiet $link_options $libdirs file $link_objects name $exe_output $libs $link_resobjects"/>
<Common name="cmds"/>
<RegEx name="Note"
--- End code ---
I did only very minor testing using OpenWatcom 32 bit.
Tim S.
mrmoelgaard:
Hello,
Excuse for resurrecting this topic. I'm using Code::Blocks as an IDE for Open Watcom in a project that targets DOS 16. My project is structured in a number of libraries linked into a console application.
I'm struggling with setting up the compiler options to achieve this an came across this post in my search for a solution.
I had already adjusted my advanced options to the settings described here. I compared the build log in the Open Watcom IDE with Code::Blocks to get it working.
But there's an issue when working with libs since wlink and wlib use different syntax for the object list.
wlink.exe requires a list of obj files separated by comma
wlib.exe requires a list of obj files separated by space
In the Other options there's only one "Object separator" so I'm a little challenged by the tool. I'm using Code::Blocks version 13.12 with Open Watcom 1.9 (latest) on a Windows 7 PC.
Any advice would be highly appreciated since I've become really fond of using Code::Blocks instead of the Open Watcom IDE.
Thanks in advance.
Best regards
Emil Moelgaard
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version