www.digitalmars.com         C & C++   DMDScript  

c++.stl.port - DMC+DOSX+OPTLINK compatibility with STL

reply Daniel Jomphe <Daniel_member pathlink.com> writes:
Hi,

I thank you for your previous answers to my questions. I am now up to the point
of making tests to decide how I will port my Win32 app to DOS using DMC.

In the course of my tests, I wanted to see if an app using STL and compiled for
DOS with DMC, using DosX services, would be possible. Unfortunately, I ran on
linker errors. I'm using OPTLINK by default, as suggested in DM's documentation.

I compile and link with these settings :

DMC myApp
-Ic:\dev\dm\stlport\stlport c:\dev\dm\lib\stlport_dm_static.lib
-mx X32.lib


Here's the code :

#include <iostream>

int main(int argc, char* argv[])
{
std::cout << "hello world";
return 0;
}

It compiles properly, and OPTLINK reports about 30 errors and an 'errorLevel
40'. I give you a sample of them:

the first one:
c:\dev\dm\lib\stlport_dm_static.lib Offset 052ACH Record Type 0088
Warning 169: Memory Model Conflict

the next ones, all about decorated names:
c:\dev\dm\lib\stlport_dm_static.lib(fstream)
Error 42: Symbol Undefined _CloseHandle 4

c:\dev\dm\lib\stlport_dm_static.lib(c_locale)
Error 42: Symbol Undefined _WideCharToMultiByte 32

C:\Dev\dm\bin\..\lib\SNN.lib(except)
Error 42: Symbol Undefined _SetUnhandledExceptionFilter 4

I also tried not using <iostream> but using <stdio.h>'s printf(...)s but
including <list> and instanciating a <list> of chars this way,

std::list<char> c;

to see if <iostream> must not be used in DOS. Again, it compiles and OPTLINK
reports many errors (with 'errorLevel 14' this time), starting with the same one
about a Memory Model Conflict. There's also some

C:\Dev\dm\bin\..\lib\SNN.lib(except)
Error 42: Symbol Undefined _SetUnhandledExceptionFilter 4



In regard of all these considerations, I'd like to know if it is possible to
compile, link and run for DOS an application using STL with DMC (or any other
compiler, but I doubt any other would do it). If so, what could I do to make my
examples work?

Thank you,

Daniel Jomphe
Nov 11 2002
parent reply Christof Meerwald <cmeerw web.de> writes:
On Mon, 11 Nov 2002 15:08:06 +0000 (UTC), Daniel Jomphe wrote:
 I compile and link with these settings :
 DMC myApp
 -Ic:\dev\dm\stlport\stlport c:\dev\dm\lib\stlport_dm_static.lib
 -mx X32.lib
Try adding -D_STLP_NO_NEW_IOSTREAMS and remove stlport_dm_static.lib (the library can only be used for Win32 programs)
 the first one:
 c:\dev\dm\lib\stlport_dm_static.lib Offset 052ACH Record Type 0088
 Warning 169: Memory Model Conflict
It's a Win32 library.
 In regard of all these considerations, I'd like to know if it is possible to
 compile, link and run for DOS an application using STL with DMC (or any other
 compiler, but I doubt any other would do it). If so, what could I do to make my
 examples work?
Compiling for DOS (32-bit) will probably work if you add -D_STLP_NO_NEW_IOSTREAMS - maybe a few changes will be necessary in stlport\config\stl_dm.h (not sure). bye, Christof -- http://cmeerw.org JID: cmeerw jabber.at mailto cmeerw at web.de ...and what have you contributed to the Net?
Nov 11 2002
parent Daniel Jomphe <Daniel_member pathlink.com> writes:
Try adding -D_STLP_NO_NEW_IOSTREAMS and remove stlport_dm_static.lib (the
library can only be used for Win32 programs)
Compiling for DOS (32-bit) will probably work if you add
-D_STLP_NO_NEW_IOSTREAMS - maybe a few changes will be necessary in
stlport\config\stl_dm.h (not sure).
Thank you, you're right, everything works fine now. I didn't have to make any change in stl_dm.h. Daniel Jomphe
Nov 12 2002