www.digitalmars.com         C & C++   DMDScript  

c++.stl.port - How to use STLport 4.62 with DMC?

reply Peter Thun <peter.thun gmx.net> writes:
Hi.

I downloaded STLport 4.62 and uncommented _STLP_NO_OWN_IOSTREAMS in 
stl_user_config.h because I didn't found a makefile for DMC. Is there any?

Then I tried to compile the following source code with: dmc -IC:\stlport 
test.cpp

#include <vector>
int main() {}

Here are the errors:

C:\dm\bin>dmc -IC:\stlport test.cpp
     using _STLP_VENDOR_EXCEPT_STD::bad_alloc;
                                            ^
C:\stlport\stl/_new.h(56) : Error: 'bad_alloc' is not a member of 
namespace 'std
'
     using _STLP_VENDOR_EXCEPT_STD::nothrow_t;
                                            ^
C:\stlport\stl/_new.h(57) : Error: 'nothrow_t' is not a member of 
namespace 'std
'
     using _STLP_VENDOR_EXCEPT_STD::nothrow;
                                          ^
C:\stlport\stl/_new.h(58) : Error: 'nothrow' is not a member of 
namespace 'std'
     using _STLP_VENDOR_EXCEPT_STD::new_handler;
                                              ^
C:\stlport\stl/_new.h(64) : Error: 'new_handler' is not a member of 
namespace 's
td'
     using _STLP_VENDOR_EXCEPT_STD::set_new_handler;
                                                  ^
C:\stlport\stl/_new.h(65) : Error: 'set_new_handler' is not a member of 
namespac
e 'std'
Fatal error: too many errors
--- errorlevel 1

Can you say me what went wrong?
Jul 22 2004
parent reply Scott Michel <scottm aero.org> writes:
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

I'm working on getting STLport 4.6.2 to compile with DMC. Getting it to 
compile is non-trivial, for example, DMC is missing a few functions 
(wmemmove, wmemcpy, wmemset), the code for which I will send to Walter 
as soon as I'm confident that STLport compiles correctly (and works!)

I'm sure that's not the answer you wanted, but it's a start. Attached is 
current patch from my work. I hope you find it useful, but there are no 
gauruntees that STLport will work. I've been trying to find out why 
test/eh/eh_test.exe doesn't work -- but now I've run into other bugs.

Unfortunately, I will be away for two weeks, leaving on Sunday night, in 
Bremerton, WA. Most likely will not have a computer where I can hack at 
night.


-scooter

Peter Thun wrote:
 Hi.
 
 I downloaded STLport 4.62 and uncommented _STLP_NO_OWN_IOSTREAMS in 
 stl_user_config.h because I didn't found a makefile for DMC. Is there any?
 
 Then I tried to compile the following source code with: dmc -IC:\stlport 
 test.cpp
 
 #include <vector>
 int main() {}
 
 Here are the errors:
 
 C:\dm\bin>dmc -IC:\stlport test.cpp
     using _STLP_VENDOR_EXCEPT_STD::bad_alloc;
                                            ^
 C:\stlport\stl/_new.h(56) : Error: 'bad_alloc' is not a member of 
 namespace 'std
 '
     using _STLP_VENDOR_EXCEPT_STD::nothrow_t;
                                            ^
 C:\stlport\stl/_new.h(57) : Error: 'nothrow_t' is not a member of 
 namespace 'std
 '
     using _STLP_VENDOR_EXCEPT_STD::nothrow;
                                          ^
 C:\stlport\stl/_new.h(58) : Error: 'nothrow' is not a member of 
 namespace 'std'
     using _STLP_VENDOR_EXCEPT_STD::new_handler;
                                              ^
 C:\stlport\stl/_new.h(64) : Error: 'new_handler' is not a member of 
 namespace 's
 td'
     using _STLP_VENDOR_EXCEPT_STD::set_new_handler;
                                                  ^
 C:\stlport\stl/_new.h(65) : Error: 'set_new_handler' is not a member of 
 namespac
 e 'std'
 Fatal error: too many errors
 --- errorlevel 1
 
 Can you say me what went wrong?

Jul 22 2004
parent reply Anuj Goyal <Anuj_member pathlink.com> writes:
you probably already knew this, but you need the paid version of DMC in order to
build a dynamic-DLL.

I think one can only build a static version with the "free" version, but I may
be mistaken.

In article <cdpp3c$1a5s$1 digitaldaemon.com>, Scott Michel says...
This is a multi-part message in MIME format.
--------------070605040206010801060700
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

I'm working on getting STLport 4.6.2 to compile with DMC. Getting it to 
compile is non-trivial, for example, DMC is missing a few functions 
(wmemmove, wmemcpy, wmemset), the code for which I will send to Walter 
as soon as I'm confident that STLport compiles correctly (and works!)

I'm sure that's not the answer you wanted, but it's a start. Attached is 
current patch from my work. I hope you find it useful, but there are no 
gauruntees that STLport will work. I've been trying to find out why 
test/eh/eh_test.exe doesn't work -- but now I've run into other bugs.

Unfortunately, I will be away for two weeks, leaving on Sunday night, in 
Bremerton, WA. Most likely will not have a computer where I can hack at 
night.


-scooter

Peter Thun wrote:
 Hi.
 
 I downloaded STLport 4.62 and uncommented _STLP_NO_OWN_IOSTREAMS in 
 stl_user_config.h because I didn't found a makefile for DMC. Is there any?
 
 Then I tried to compile the following source code with: dmc -IC:\stlport 
 test.cpp
 
 #include <vector>
 int main() {}
 
 Here are the errors:
 
 C:\dm\bin>dmc -IC:\stlport test.cpp
     using _STLP_VENDOR_EXCEPT_STD::bad_alloc;
                                            ^
 C:\stlport\stl/_new.h(56) : Error: 'bad_alloc' is not a member of 
 namespace 'std
 '
     using _STLP_VENDOR_EXCEPT_STD::nothrow_t;
                                            ^
 C:\stlport\stl/_new.h(57) : Error: 'nothrow_t' is not a member of 
 namespace 'std
 '
     using _STLP_VENDOR_EXCEPT_STD::nothrow;
                                          ^
 C:\stlport\stl/_new.h(58) : Error: 'nothrow' is not a member of 
 namespace 'std'
     using _STLP_VENDOR_EXCEPT_STD::new_handler;
                                              ^
 C:\stlport\stl/_new.h(64) : Error: 'new_handler' is not a member of 
 namespace 's
 td'
     using _STLP_VENDOR_EXCEPT_STD::set_new_handler;
                                                  ^
 C:\stlport\stl/_new.h(65) : Error: 'set_new_handler' is not a member of 
 namespac
 e 'std'
 Fatal error: too many errors
 --- errorlevel 1
 
 Can you say me what went wrong?

--------------070605040206010801060700 Content-Type: text/plain; name="dm.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="dm.patch" Index: src/num_put.cpp =================================================================== RCS file: /stlport/STLport/src/num_put.cpp,v retrieving revision 1.7 diff -u -r1.7 num_put.cpp --- src/num_put.cpp 2 Feb 2004 10:38:50 -0000 1.7 +++ src/num_put.cpp 23 Jul 2004 00:56:21 -0000 -27,8 +27,8 extern const char __hex_char_table_lo[]; extern const char __hex_char_table_hi[]; -const char __hex_char_table_lo[18] = "0123456789abcdefx"; -const char __hex_char_table_hi[18] = "0123456789ABCDEFX"; +_STLP_EXPORT_DECLSPEC const char __hex_char_table_lo[18] = "0123456789abcdefx"; +_STLP_EXPORT_DECLSPEC const char __hex_char_table_hi[18] = "0123456789ABCDEFX"; char* _STLP_CALL __write_integer(char* buf, ios_base::fmtflags flags, long x) Index: stlport/config/stl_dm.h =================================================================== RCS file: /stlport/STLport/stlport/config/stl_dm.h,v retrieving revision 1.3 diff -u -r1.3 stl_dm.h --- stlport/config/stl_dm.h 14 Nov 2003 15:28:18 -0000 1.3 +++ stlport/config/stl_dm.h 23 Jul 2004 00:56:23 -0000 -100,7 +100,7 # undef _STLP_NO_LONG_DOUBLE # undef _STLP_NEED_MUTABLE # undef _STLP_NO_PARTIAL_SPECIALIZATION_SYNTAX -# undef _STLP_NO_BAD_ALLOC +# define _STLP_NO_BAD_ALLOC # undef _STLP_DEBUG_ALLOC # undef _STLP_NO_MEMBER_TEMPLATES # undef _STLP_NO_MEMBER_TEMPLATE_CLASSES -132,6 +132,7 # undef _STLP_NO_TEMPLATE_CONVERSIONS # undef _STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS +# undef _STLP_MULTI_CONST_TEMPLATE_ARG_BUG # define _STLP_NO_NATIVE_MBSTATE_T -168,43 +169,43 # if defined (_STLP_DEBUG) # if defined (_DLL) # if !defined (_STLP_DONT_USE_DLL) -# pragma comment(lib,"stlp45dm_stldebug.lib") +# pragma comment(lib,"stlp46dm_stldebug.lib") # else -# pragma comment(lib,"stlp45dm_stldebug_staticx.lib") +# pragma comment(lib,"stlp46dm_stldebug_staticx.lib") # endif # else # if defined (_STLP_USE_DLL) -# pragma comment(lib,"stlp45dms_stldebug.lib") +# pragma comment(lib,"stlp46dms_stldebug.lib") # else -# pragma comment(lib,"stlp45dm_stldebug_static.lib") +# pragma comment(lib,"stlp46dm_stldebug_static.lib") # endif # endif # elif defined (DEBUG) # if defined (_DLL) # if !defined (_STLP_DONT_USE_DLL) -# pragma comment(lib,"stlp45dm_debug.lib") +# pragma comment(lib,"stlp46dm_debug.lib") # else -# pragma comment(lib,"stlp45dm_debug_staticx.lib") +# pragma comment(lib,"stlp46dm_debug_staticx.lib") # endif # else # if defined (_STLP_USE_DLL) -# pragma comment(lib,"stlp45dms_debug.lib") +# pragma comment(lib,"stlp46dms_debug.lib") # else -# pragma comment(lib,"stlp45dm_debug_static.lib") +# pragma comment(lib,"stlp46dm_debug_static.lib") # endif # endif # else # if defined (_DLL) # if !defined (_STLP_DONT_USE_DLL) -# pragma comment(lib,"stlp45dm.lib") +# pragma comment(lib,"stlp46dm.lib") # else -# pragma comment(lib,"stlp45dm_staticx.lib") +# pragma comment(lib,"stlp46dm_staticx.lib") # endif # else # if defined (_STLP_USE_DLL) -# pragma comment(lib,"stlp45dms.lib") +# pragma comment(lib,"stlp46dms.lib") # else -# pragma comment(lib,"stlp45dm_static.lib") +# pragma comment(lib,"stlp46dm_static.lib") # endif # endif # endif Index: stlport/stl/_map.h =================================================================== RCS file: /stlport/STLport/stlport/stl/_map.h,v retrieving revision 1.7 diff -u -r1.7 _map.h --- stlport/stl/_map.h 14 May 2004 20:19:46 -0000 1.7 +++ stlport/stl/_map.h 23 Jul 2004 00:56:24 -0000 -66,8 +66,10 } }; + public: + typedef _Const_traits<value_type> _ConstIteTraits; + protected: - typedef _Const_traits<value_type> _ConstIteTraits; # ifdef _STLP_MULTI_CONST_TEMPLATE_ARG_BUG typedef _Rb_tree<key_type, key_compare, value_type, _Select1st_hint<value_type, _Key>, _ConstIteTraits, _Alloc> _Rep_type; Index: stlport/stl/_rope.c =================================================================== RCS file: /stlport/STLport/stlport/stl/_rope.c,v retrieving revision 1.11 diff -u -r1.11 _rope.c --- stlport/stl/_rope.c 11 Apr 2004 17:07:53 -0000 1.11 +++ stlport/stl/_rope.c 23 Jul 2004 00:56:24 -0000 -341,11 +341,11 } case _S_substringfn: { - typedef _Rope_RopeSubstring<_CharT,_Alloc> _Rope_RopeSubstring_T; - _Rope_RopeSubstring_T* __ss = (_Rope_RopeSubstring_T*)this; - _STLP_STD::_Destroy(__ss); + typedef _Rope_RopeSubstring<_CharT,_Alloc> _Rope_RopeSubstringT; + _Rope_RopeSubstringT* __subs = (_Rope_RopeSubstringT*)this; + _STLP_STD::_Destroy(__subs); _STLP_CREATE_ALLOCATOR(allocator_type,(const allocator_type&)_M_size, - _Rope_RopeSubstring_T).deallocate(__ss, 1); + _Rope_RopeSubstringT).deallocate(__subs, 1); break; } } Index: stlport/stl/_tree.h =================================================================== RCS file: /stlport/STLport/stlport/stl/_tree.h,v retrieving revision 1.18 diff -u -r1.18 _tree.h --- stlport/stl/_tree.h 14 May 2004 20:19:46 -0000 1.18 +++ stlport/stl/_tree.h 23 Jul 2004 00:56:24 -0000 -274,6 +274,11 typedef ptrdiff_t difference_type; typedef bidirectional_iterator_tag _Iterator_category; typedef typename _Base::allocator_type allocator_type; + + typedef typename _ConstIteTraits::_Non_const_traits _NonConstIteTraits; + typedef _Rb_tree_iterator<value_type, _NonConstIteTraits> iterator; + typedef _Rb_tree_iterator<value_type, _ConstIteTraits> const_iterator; + _STLP_DECLARE_BIDIRECTIONAL_REVERSE_ITERATORS; protected: -332,11 +337,8 { return _Rb_tree_node_base::_S_maximum(__x); } public: - typedef typename _ConstIteTraits::_Non_const_traits _NonConstIteTraits; - typedef _Rb_tree_iterator<value_type, _NonConstIteTraits> iterator; - typedef _Rb_tree_iterator<value_type, _ConstIteTraits> const_iterator; - _STLP_DECLARE_BIDIRECTIONAL_REVERSE_ITERATORS; - + // Put stuff back here, if needed. + private: iterator _M_insert(_Base_ptr __parent, const value_type& __val, _Base_ptr __on_left = 0, _Base_ptr __on_right = 0); _Base_ptr _M_copy(_Base_ptr __x, _Base_ptr __p); Index: stlport/stl/debug/_debug.h =================================================================== RCS file: /stlport/STLport/stlport/stl/debug/_debug.h,v retrieving revision 1.15 diff -u -r1.15 _debug.h --- stlport/stl/debug/_debug.h 22 Apr 2004 20:39:25 -0000 1.15 +++ stlport/stl/debug/_debug.h 23 Jul 2004 00:56:24 -0000 -344,12 +344,12 mutable __owned_link _M_node; mutable _STLP_mutex _M_lock; -private: - // should never be called, should be left undefined, - // but some compilers complain about it ;( + // STLport claims that the copy ctor and assignment operators should never + // be called, but the Digital Mars compiler does generate the code... __owned_list(const __owned_list&){} void operator=(const __owned_list&) {} +private: friend class __owned_link; friend struct __stl_debug_engine<bool>; }; -380,9 +380,9 #ifndef _STLP_MEMBER_TEMPLATES template <class _Tp, class _InputIterator> -class __range_checker { +class __range_checker { #else -class _STLP_CLASS_DECLSPEC __range_checker { +class _STLP_CLASS_DECLSPEC __range_checker { #endif protected: __range_checker() {} Index: stlport/stl/debug/_list.h =================================================================== RCS file: /stlport/STLport/stlport/stl/debug/_list.h,v retrieving revision 1.14 diff -u -r1.14 _list.h --- stlport/stl/debug/_list.h 22 Apr 2004 20:39:25 -0000 1.14 +++ stlport/stl/debug/_list.h 23 Jul 2004 00:56:24 -0000 -60,7 +60,7 # endif template <class _Tp, _STLP_DEFAULT_ALLOCATOR_SELECT(_Tp) > -class _DBG_list : private _STLP_RANGE_CHECKER(_Tp, typename _STLP_DBG_LIST_BASE::const_iterator), +class _DBG_list : protected _STLP_RANGE_CHECKER(_Tp, typename _STLP_DBG_LIST_BASE::const_iterator), public _STLP_DBG_LIST_BASE { typedef _STLP_DBG_LIST_BASE _Base; typedef _DBG_list<_Tp, _Alloc> _Self; Index: stlport/stl/debug/_string.h =================================================================== RCS file: /stlport/STLport/stlport/stl/debug/_string.h,v retrieving revision 1.15 diff -u -r1.15 _string.h --- stlport/stl/debug/_string.h 11 Apr 2004 17:11:25 -0000 1.15 +++ stlport/stl/debug/_string.h 23 Jul 2004 00:56:25 -0000 -39,7 +39,7 # endif template <class _CharT, class _Traits, class _Alloc> -class basic_string : private _STLP_RANGE_CHECKER(_CharT, typename _STLP_DBG_STRING_BASE::const_iterator), +class basic_string : protected _STLP_RANGE_CHECKER(_CharT, typename _STLP_DBG_STRING_BASE::const_iterator), public _STLP_DBG_STRING_BASE { private: typedef _STLP_DBG_STRING_BASE _Base; Index: stlport/stl/debug/_vector.h =================================================================== RCS file: /stlport/STLport/stlport/stl/debug/_vector.h,v retrieving revision 1.19 diff -u -r1.19 _vector.h --- stlport/stl/debug/_vector.h 11 Apr 2004 17:11:25 -0000 1.19 +++ stlport/stl/debug/_vector.h 23 Jul 2004 00:56:25 -0000 -89,7 +89,7 }; template <class _Tp, _STLP_DBG_ALLOCATOR_SELECT(_Tp) > -class _DBG_vector : private _STLP_RANGE_CHECKER(_Tp, typename _STLP_DBG_VECTOR_BASE::const_iterator), +class _DBG_vector : protected _STLP_RANGE_CHECKER(_Tp, typename _STLP_DBG_VECTOR_BASE::const_iterator), public _STLP_DBG_VECTOR_BASE { private: Index: test/eh/test_map.cpp =================================================================== RCS file: /stlport/STLport/test/eh/test_map.cpp,v retrieving revision 1.1.1.1.2.1 diff -u -r1.1.1.1.2.1 test_map.cpp --- test/eh/test_map.cpp 19 Jan 2003 17:20:26 -0000 1.1.1.1.2.1 +++ test/eh/test_map.cpp 23 Jul 2004 00:56:26 -0000 -45,7 +45,7 return map_tag(); } -typedef EH_STD::__multimap__<TestClass, TestClass, ThrowCompare, eh_allocator(TestClass) > TestMultiMap; +typedef EH_STD::multimap<TestClass, TestClass, ThrowCompare, eh_allocator(TestClass) > TestMultiMap; void test_multimap() { Index: test/eh/test_slist.cpp =================================================================== RCS file: /stlport/STLport/test/eh/test_slist.cpp,v retrieving revision 1.1.1.1.2.3 diff -u -r1.1.1.1.2.3 test_slist.cpp --- test/eh/test_slist.cpp 2 Sep 2003 19:57:12 -0000 1.1.1.1.2.3 +++ test/eh/test_slist.cpp 23 Jul 2004 00:56:26 -0000 -33,7 +33,7 _STLP_INSTRUMENT_FILE(); # endif -typedef EH_STD::__slist__<TestClass, eh_allocator(TestClass) > TestSList; +typedef EH_STD::slist<TestClass, eh_allocator(TestClass) > TestSList; inline sequence_container_tag container_category(const TestSList&) Index: test/eh/test_vector.cpp =================================================================== RCS file: /stlport/STLport/test/eh/test_vector.cpp,v retrieving revision 1.1.1.1.2.1 diff -u -r1.1.1.1.2.1 test_vector.cpp --- test/eh/test_vector.cpp 19 Jan 2003 17:20:27 -0000 1.1.1.1.2.1 +++ test/eh/test_vector.cpp 23 Jul 2004 00:56:26 -0000 -27,7 +27,7 #include "test_insert.h" #include "test_push_front.h" -typedef EH_STD::__vector__<TestClass, eh_allocator(TestClass) > TestVector; +typedef EH_STD::vector<TestClass, eh_allocator(TestClass) > TestVector; inline sequence_container_tag container_category(const TestVector&) Index: src/dm.mak =================================================================== RCS file: src/dm.mak diff -N src/dm.mak --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ src/dm.mak 1 Jan 1970 00:00:00 -0000 -0,0 +1,327 +# -*- Makefile -*- +.SUFFIXES: .cpp .c .obj .dll .exe .rc .res + + +CXX=dmc +CC=dmc -cpp +LIB=lib +LINK=dmc +RC=rcc + +LIB_BASENAME=stlp46dm + +OBJS = \ + build\dll_main.obj \ + build\dm_extra.obj \ + build\fstream.obj \ + build\strstream.obj \ + build\sstream.obj \ + build\ios.obj \ + build\stdio_streambuf.obj \ + build\istream.obj \ + build\ostream.obj \ + build\iostream.obj \ + build\codecvt.obj \ + build\collate.obj \ + build\ctype.obj \ + build\monetary.obj \ + build\num_get.obj \ + build\num_put.obj \ + build\num_get_float.obj \ + build\num_put_float.obj \ + build\numpunct.obj \ + build\time_facets.obj \ + build\messages.obj \ + build\locale_impl.obj \ + build\locale.obj \ + build\locale_catalog.obj \ + build\facets_byname.obj \ + build\c_locale.obj \ + build\c_locale_stub.obj \ + build\complex.obj \ + build\complex_exp.obj \ + build\complex_io.obj \ + build\complex_trig.obj \ + build\complex_io_w.obj \ + build\string_w.obj + +BUILD_DIRS=..\lib ..\build ..\build\c_locale_win32 \ + ..\build\static ..\build\static\c_locale_win32 \ + ..\build\static\release ..\build\release\c_locale_win32 \ + ..\build\static\debug ..\build\static\debug\c_locale_win32 \ + ..\build\static\stldebug ..\build\static\stldebug\c_locale_win32 \ + ..\build\staticx ..\build\staticx\c_locale_win32 \ + ..\build\staticx\release ..\build\staticx\release\c_locale_win32 \ + ..\build\staticx\debug ..\build\staticx\debug\c_locale_win32 \ + ..\build\staticx\stldebug ..\build\staticx\stldebug\c_locale_win32 \ + ..\build\dynamic ..\build\dynamic\c_locale_win32 \ + ..\build\dynamic\release ..\build\dynamic\release\c_locale_win32 \ + ..\build\dynamic\debug ..\build\dynamic\debug\c_locale_win32 \ + ..\build\dynamic\stldebug ..\build\dynamic\stldebug\c_locale_win32 \ + ..\build\sdynamic ..\build\sdynamic\c_locale_win32 \ + ..\build\sdynamic\release ..\build\sdynamic\release\c_locale_win32 \ + ..\build\sdynamic\debug ..\build\sdynamic\debug\c_locale_win32 \ + ..\build\sdynamic\stldebug ..\build\sdynamic\stldebug\c_locale_win32 + + +CXXFLAGS_COMMON = -Ae -Ar -DSTRICT -D__BUILDING_STLPORT -I../stlport +CXXFLAGS_dynamic = -WD + +# four versions are currently supported: +# - static: static STLport library, static RTL +# - staticx: static STLport library, dynamic RTL +# - dynamic: dynamic STLport library, dynamic RTL +# - sdynamic: dynamic STLport library, static RTL + +CXXFLAGS_RELEASE_static = $(CXXFLAGS_COMMON) -o+all -Nc -D_MT +CXXFLAGS_RELEASE_staticx = $(CXXFLAGS_COMMON) -o+all -Nc -ND +CXXFLAGS_RELEASE_dynamic = $(CXXFLAGS_COMMON) $(CXXFLAGS_dynamic) -o+all -ND +CXXFLAGS_RELEASE_sdynamic = $(CXXFLAGS_COMMON) $(CXXFLAGS_dynamic) -D_MT -o+all + +CXXFLAGS_DEBUG_static = $(CXXFLAGS_COMMON) -g -Nc -D_MT +CXXFLAGS_DEBUG_staticx = $(CXXFLAGS_COMMON) -g -Nc -ND +CXXFLAGS_DEBUG_dynamic = $(CXXFLAGS_COMMON) $(CXXFLAGS_dynamic) -g -ND +CXXFLAGS_DEBUG_sdynamic = $(CXXFLAGS_COMMON) $(CXXFLAGS_dynamic) -g -D_MT + +CXXFLAGS_STLDEBUG_static = $(CXXFLAGS_DEBUG_static) -D_STLP_DEBUG -g -Nc -D_MT +CXXFLAGS_STLDEBUG_staticx = $(CXXFLAGS_DEBUG_static) -D_STLP_DEBUG -g -Nc -ND +CXXFLAGS_STLDEBUG_dynamic = $(CXXFLAGS_DEBUG_dynamic) $(CXXFLAGS_dynamic) -D_STLP_DEBUG -g -ND +CXXFLAGS_STLDEBUG_sdynamic = $(CXXFLAGS_DEBUG_dynamic) $(CXXFLAGS_dynamic) -D_STLP_DEBUG -g -D_MT + + +.cpp{..\build\static\release}.obj: + $(CXX) -c -o"$ " $(CXXFLAGS_RELEASE_static) "$<" + +.cpp{..\build\static\debug}.obj: + $(CXX) -c -o"$ " $(CXXFLAGS_DEBUG_static) "$<" + +.cpp{..\build\static\stldebug}.obj: + $(CXX) -c -o"$ " $(CXXFLAGS_STLDEBUG_static) "$<" + +.cpp{..\build\staticx\release}.obj: + $(CXX) -c -o"$ " $(CXXFLAGS_RELEASE_staticx) "$<" + +.cpp{..\build\staticx\debug}.obj: + $(CXX) -c -o"$ " $(CXXFLAGS_DEBUG_staticx) "$<" + +.cpp{..\build\staticx\stldebug}.obj: + $(CXX) -c -o"$ " $(CXXFLAGS_STLDEBUG_staticx) "$<" + +.cpp{..\build\dynamic\release}.obj: + $(CXX) -c -o"$ " $(CXXFLAGS_RELEASE_dynamic) "$<" + +.cpp{..\build\dynamic\debug}.obj: + $(CXX) -c -o"$ " $(CXXFLAGS_DEBUG_dynamic) "$<" + +.cpp{..\build\dynamic\stldebug}.obj: + $(CXX) -c -o"$ " $(CXXFLAGS_STLDEBUG_dynamic) "$<" + +.cpp{..\build\sdynamic\release}.obj: + $(CXX) -c -o"$ " $(CXXFLAGS_RELEASE_sdynamic) "$<" + +.cpp{..\build\sdynamic\debug}.obj: + $(CXX) -c -o"$ " $(CXXFLAGS_DEBUG_sdynamic) "$<" + +.cpp{..\build\sdynamic\stldebug}.obj: + $(CXX) -c -o"$ " $(CXXFLAGS_STLDEBUG_sdynamic) "$<" + +.c{..\build\static\release}.obj: + $(CC) -c -o"$ " $(CXXFLAGS_RELEASE_static) "$<" + +.c{..\build\static\debug}.obj: + $(CC) -c -o"$ " $(CXXFLAGS_DEBUG_static) "$<" + +.c{..\build\static\stldebug}.obj: + $(CC) -c -o"$ " $(CXXFLAGS_STLDEBUG_static) "$<" + +.c{..\build\staticx\release}.obj: + $(CC) -c -o"$ " $(CXXFLAGS_RELEASE_staticx) "$<" + +.c{..\build\staticx\debug}.obj: + $(CC) -c -o"$ " $(CXXFLAGS_DEBUG_staticx) "$<" + +.c{..\build\staticx\stldebug}.obj: + $(CC) -c -o"$ " $(CXXFLAGS_STLDEBUG_staticx) "$<" + +.c{..\build\dynamic\release}.obj: + $(CC) -c -o"$ " $(CXXFLAGS_RELEASE_dynamic) "$<" + +.c{..\build\dynamic\debug}.obj: + $(CC) -c -o"$ " $(CXXFLAGS_DEBUG_dynamic) "$<" + +.c{..\build\dynamic\stldebug}.obj: + $(CC) -c -o"$ " $(CXXFLAGS_STLDEBUG_dynamic) "$<" + +.c{..\build\sdynamic\release}.obj: + $(CC) -c -o"$ " $(CXXFLAGS_RELEASE_sdynamic) "$<" + +.c{..\build\sdynamic\debug}.obj: + $(CC) -c -o"$ " $(CXXFLAGS_DEBUG_sdynamic) "$<" + +.c{..\build\sdynamic\stldebug}.obj: + $(CC) -c -o"$ " $(CXXFLAGS_STLDEBUG_sdynamic) "$<" + +.rc{..\build}.res: + $(RC) -32 -o"$ " "$<" + + +all: directories all_static all_staticx all_dynamic all_sdynamic + +clean: + -rd /s/q ..\lib + -rd /s/q ..\build + + +directories: $(BUILD_DIRS) + +$(BUILD_DIRS): + mkdir $ + +all_static: ..\lib\$(LIB_BASENAME)_static.lib ..\lib\$(LIB_BASENAME)_debug_static.lib ..\lib\$(LIB_BASENAME)_stldebug_static.lib + +..\lib\$(LIB_BASENAME)_static.lib: $(OBJS:build\=..\build\static\release\) + *$(LIB) -c -n -p512 "$ " "$**" + +..\lib\$(LIB_BASENAME)_debug_static.lib: $(OBJS:build\=..\build\static\debug\) + *$(LIB) -c -n -p512 "$ " "$**" + +..\lib\$(LIB_BASENAME)_stldebug_static.lib: $(OBJS:build\=..\build\static\stldebug\) + *$(LIB) -c -n -p512 "$ " "$**" + + +all_staticx: ..\lib\$(LIB_BASENAME)_staticx.lib ..\lib\$(LIB_BASENAME)_debug_staticx.lib ..\lib\$(LIB_BASENAME)_stldebug_staticx.lib + +..\lib\$(LIB_BASENAME)_staticx.lib: $(OBJS:build\=..\build\staticx\release\) + *$(LIB) -c -n -p512 "$ " "$**" + +..\lib\$(LIB_BASENAME)_debug_staticx.lib: $(OBJS:build\=..\build\staticx\debug\) + *$(LIB) -c -n -p512 "$ " "$**" + +..\lib\$(LIB_BASENAME)_stldebug_staticx.lib: $(OBJS:build\=..\build\staticx\stldebug\) + *$(LIB) -c -n -p512 "$ " "$**" + + +all_dynamic: ..\lib\$(LIB_BASENAME).dll ..\lib\$(LIB_BASENAME)_debug.dll ..\lib\$(LIB_BASENAME)_stldebug.dll + +..\lib\$(LIB_BASENAME).dll: $(OBJS:build\=..\build\dynamic\release\) ..\build\stlport.res + *$(LINK) -WD -ND -L/IMPLIB:$( R).lib -L/NOMAP -L/NODEBUG -o"$ " "$**" user32.lib kernel32.lib <<$( R).def +LIBRARY "$( F)" +DESCRIPTION 'STLport DLL for Digital Mars C/C++' +EXETYPE NT +SUBSYSTEM WINDOWS +CODE SHARED EXECUTE +DATA READWRITE + +EXPORTS + "?cin std 3V?$basic_istream std DV?$char_traits std D 1 1 A" + "?cout std 3V?$basic_ostream std DV?$char_traits std D 1 1 A" + "?cerr std 3V?$basic_ostream std DV?$char_traits std D 1 1 A" + "?clog std 3V?$basic_ostream std DV?$char_traits std D 1 1 A" + "?wcin std 3V?$basic_istream std _YV?$char_traits std _Y 1 1 A" + "?wcout std 3V?$basic_ostream std _YV?$char_traits std _Y 1 1 A" + "?wcerr std 3V?$basic_ostream std _YV?$char_traits std _Y 1 1 A" + "?wclog std 3V?$basic_ostream std _YV?$char_traits std _Y 1 1 A" +<< + +..\lib\$(LIB_BASENAME)_debug.dll: $(OBJS:build\=..\build\dynamic\debug\) ..\build\stlport.res + *$(LINK) -WD -ND -g -L/IMPLIB:$( R).lib -L/NOMAP -L/DEBUG -o"$ " "$**" user32.lib kernel32.lib <<$( R).def +LIBRARY "$( F)" +DESCRIPTION 'STLport DLL for Digital Mars C/C++' +EXETYPE NT +SUBSYSTEM WINDOWS +CODE SHARED EXECUTE +DATA READWRITE + +EXPORTS + "?cin std 3V?$basic_istream std DV?$char_traits std D 1 1 A" + "?cout std 3V?$basic_ostream std DV?$char_traits std D 1 1 A" + "?cerr std 3V?$basic_ostream std DV?$char_traits std D 1 1 A" + "?clog std 3V?$basic_ostream std DV?$char_traits std D 1 1 A" + "?wcin std 3V?$basic_istream std _YV?$char_traits std _Y 1 1 A" + "?wcout std 3V?$basic_ostream std _YV?$char_traits std _Y 1 1 A" + "?wcerr std 3V?$basic_ostream std _YV?$char_traits std _Y 1 1 A" + "?wclog std 3V?$basic_ostream std _YV?$char_traits std _Y 1 1 A" +<< + +..\lib\$(LIB_BASENAME)_stldebug.dll: $(OBJS:build\=..\build\dynamic\stldebug\) ..\build\stlport.res + *$(LINK) -WD -ND -g -L/IMPLIB:$( R).lib -L/NOMAP -L/DEBUG -o"$ " "$**" user32.lib kernel32.lib <<$( R).def +LIBRARY "$( F)" +DESCRIPTION 'STLport DLL for Digital Mars C/C++' +EXETYPE NT +SUBSYSTEM WINDOWS +CODE SHARED EXECUTE +DATA READWRITE + +EXPORTS + "?cin std 3V?$basic_istream std DV?$char_traits std D 1 1 A" + "?cout std 3V?$basic_ostream std DV?$char_traits std D 1 1 A" + "?cerr std 3V?$basic_ostream std DV?$char_traits std D 1 1 A" + "?clog std 3V?$basic_ostream std DV?$char_traits std D 1 1 A" + "?wcin std 3V?$basic_istream std _YV?$char_traits std _Y 1 1 A" + "?wcout std 3V?$basic_ostream std _YV?$char_traits std _Y 1 1 A" + "?wcerr std 3V?$basic_ostream std _YV?$char_traits std _Y 1 1 A" + "?wclog std 3V?$basic_ostream std _YV?$char_traits std _Y 1 1 A" +<< + + +all_sdynamic: ..\lib\$(LIB_BASENAME)s.dll ..\lib\$(LIB_BASENAME)s_debug.dll ..\lib\$(LIB_BASENAME)s_stldebug.dll + +..\lib\$(LIB_BASENAME)s.dll: $(OBJS:build\=..\build\sdynamic\release\) ..\build\stlport.res + *$(LINK) -WD -ND -L/IMPLIB:$( R).lib -L/NOMAP -L/NODEBUG -o"$ " "$**" user32.lib kernel32.lib <<$( R).def +LIBRARY "$( F)" +DESCRIPTION 'STLport DLL for Digital Mars C/C++' +EXETYPE NT +SUBSYSTEM WINDOWS +CODE SHARED EXECUTE +DATA READWRITE + +EXPORTS + "?cin std 3V?$basic_istream std DV?$char_traits std D 1 1 A" + "?cout std 3V?$basic_ostream std DV?$char_traits std D 1 1 A" + "?cerr std 3V?$basic_ostream std DV?$char_traits std D 1 1 A" + "?clog std 3V?$basic_ostream std DV?$char_traits std D 1 1 A" + "?wcin std 3V?$basic_istream std _YV?$char_traits std _Y 1 1 A" + "?wcout std 3V?$basic_ostream std _YV?$char_traits std _Y 1 1 A" + "?wcerr std 3V?$basic_ostream std _YV?$char_traits std _Y 1 1 A" + "?wclog std 3V?$basic_ostream std _YV?$char_traits std _Y 1 1 A" +<< + +..\lib\$(LIB_BASENAME)s_debug.dll: $(OBJS:build\=..\build\sdynamic\debug\) ..\build\stlport.res + *$(LINK) -WD -ND -g -L/IMPLIB:$( R).lib -L/NOMAP -L/DEBUG -o"$ " "$**" user32.lib kernel32.lib <<$( R).def +LIBRARY "$( F)" +DESCRIPTION 'STLport DLL for Digital Mars C/C++' +EXETYPE NT +SUBSYSTEM WINDOWS +CODE SHARED EXECUTE +DATA READWRITE + +EXPORTS + "?cin std 3V?$basic_istream std DV?$char_traits std D 1 1 A" + "?cout std 3V?$basic_ostream std DV?$char_traits std D 1 1 A" + "?cerr std 3V?$basic_ostream std DV?$char_traits std D 1 1 A" + "?clog std 3V?$basic_ostream std DV?$char_traits std D 1 1 A" + "?wcin std 3V?$basic_istream std _YV?$char_traits std _Y 1 1 A" + "?wcout std 3V?$basic_ostream std _YV?$char_traits std _Y 1 1 A" + "?wcerr std 3V?$basic_ostream std _YV?$char_traits std _Y 1 1 A" + "?wclog std 3V?$basic_ostream std _YV?$char_traits std _Y 1 1 A" +<< + +..\lib\$(LIB_BASENAME)s_stldebug.dll: $(OBJS:build\=..\build sdynamic\stldebug\) ..\build\stlport.res + *$(LINK) -WD -ND -g -L/IMPLIB:$( R).lib -L/NOMAP -L/DEBUG -o"$ " "$**" user32.lib kernel32.lib <<$( R).def +LIBRARY "$( F)" +DESCRIPTION 'STLport DLL for Digital Mars C/C++' +EXETYPE NT +SUBSYSTEM WINDOWS +CODE SHARED EXECUTE +DATA READWRITE + +EXPORTS + "?cin std 3V?$basic_istream std DV?$char_traits std D 1 1 A" + "?cout std 3V?$basic_ostream std DV?$char_traits std D 1 1 A" + "?cerr std 3V?$basic_ostream std DV?$char_traits std D 1 1 A" + "?clog std 3V?$basic_ostream std DV?$char_traits std D 1 1 A" + "?wcin std 3V?$basic_istream std _YV?$char_traits std _Y 1 1 A" + "?wcout std 3V?$basic_ostream std _YV?$char_traits std _Y 1 1 A" + "?wcerr std 3V?$basic_ostream std _YV?$char_traits std _Y 1 1 A" + "?wclog std 3V?$basic_ostream std _YV?$char_traits std _Y 1 1 A" +<< Index: src/dm_extra.c =================================================================== RCS file: src/dm_extra.c diff -N src/dm_extra.c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ src/dm_extra.c 1 Jan 1970 00:00:00 -0000 -0,0 +1,33 +// Extra functions that DMC/C++ should have, but for some reason doesn't. + +#include <string.h> +#include <sys/types.h> + +#if 1 + +// Workaround b/c DMC should have wmem* functions, but apparently doesn't for +// certain versions of the compiler + +_STLP_EXPORT_DECLSPEC wchar_t * +wmemmove(wchar_t *dst, const wchar_t *src, size_t n) +{ + return ((wchar_t *) memmove(dst, src, n*sizeof(wchar_t))); +} + +_STLP_EXPORT_DECLSPEC wchar_t * +wmemcpy(wchar_t *dst, const wchar_t *src, size_t n) +{ + return ((wchar_t *) memcpy(dst, src, n*sizeof(wchar_t))); +} + +_STLP_EXPORT_DECLSPEC wchar_t * +wmemset(wchar_t *wbuf, const wchar_t wc, size_t n) +{ + wchar_t *ret = wbuf; + + while (--n > 0) + *wbuf++ = wc; + + return ret; +} +#endif --------------070605040206010801060700--

Jul 26 2004
parent reply Scott Michel <scottm aero.org> writes:
Anuj Goyal wrote:
 you probably already knew this, but you need the paid version of DMC in order
to
 build a dynamic-DLL.
 
 I think one can only build a static version with the "free" version, but I may
 be mistaken.

I think you are mistaken. All compiler flags work on the free compiler, last time I worked with it. You get a lot of other tools with the CD. I can assure you that there isn't any significant difference between the CD version and the "free" version.
Aug 12 2004
parent reply Anuj Goyal <Anuj_member pathlink.com> writes:
hmm, you maybe right, I have not seen a discussion about dynamic vs. static
linking in the executables... This is somewhat related, but is there any reason
why my executable is so big?  on linux, the same code compiles to 5KB!  The DMC
compile is almost 8 times as big.... what am I doing wrong?

C:\workdmc>cat hello.cpp
#include <stdio.h>
#include <iostream.h>

int
main()
{
printf("hello world\n");

return 0;

}

C:\workdmc>dmc -WA hello.cpp -Ic:\dm\include
link hello,,,user32+kernel32/noi;


C:\workdmc>ls -lrt hello.*
-rw-rw-rw-   1 user     group         118 Aug 16 22:52 hello.cpp~
-rw-rw-rw-   1 user     group         107 Aug 16 22:52 hello.cpp
-rw-rw-rw-   1 user     group        2204 Aug 16 22:53 hello.map
-rw-rw-rw-   1 user     group         253 Aug 16 22:53 hello.obj
-rwxrwxrwx   1 user     group       39964 Aug 16 22:53 hello.exe
Aug 16 2004
next sibling parent Scott Michel <scottm aero.org> writes:
 C:\workdmc>dmc -WA hello.cpp -Ic:\dm\include
 link hello,,,user32+kernel32/noi;

Add "-ND" to your command line. BTW: I wouldn't worry too much about executable size unless you're trying to fit the entire app on a flopppy. The primary reason Linux (and FreeBSD, DragonFly, NetBSD, OpenBSD, etc.) are smaller is because there are fewer platform variants.
Aug 17 2004
prev sibling parent reply Scott Michel <scottm aero.org> writes:
Anuj Goyal wrote:

 C:\workdmc>cat hello.cpp
 #include <stdio.h>
 #include <iostream.h>
 
 int
 main()
 {
 printf("hello world\n");
 
 return 0;
 
 }

Also, use puts and not printf -- smaller stdio code overhead. With -ND, I can get the size down to 11K. Most the rest of the overhead you're seeing is likely related to startup code. Windows has historically had "nastier" startup (stuff in the WinMain() function) than Unixen.
Aug 17 2004
parent reply Anuj Goyal <Anuj_member pathlink.com> writes:
forgive my noobiness, what is the difference between snn.lib and snd.lib? is one
dynamic and the other static?  I only have snn.lib

According to this post, I will have to buy the CD to get the snd.lib

http://www.digitalmars.com/archives/cplusplus/504.html

C:\workdmc>dmc -mn -ND -WA hello.cpp -Ic:\dm\include -L/impl:c:\dm\lib\snn.lib
link hello,,,user32+kernel32/noi/impl:c:\dm\lib\snn.lib;
OPTLINK (R) for Win32  Release 7.50B1
Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved

SND.lib
Warning 2: File Not Found SND.lib
OPTLINK : Warning 23: No Stack
hello.obj(hello)
Error 42: Symbol Undefined __acrtused_con
hello.obj(hello)
Error 42: Symbol Undefined _printf
OPTLINK : Warning 134: No Start Address

--- errorlevel 2

C:\dm\lib>dir sn*
Volume in drive C is COMPUTER
Volume Serial Number is E0E1-2C62

Directory of C:\dm\lib

02/15/2004  01:52a             548,352 snn.lib
Aug 24 2004
parent Scott Michel <scottm aero.org> writes:
Anuj Goyal wrote:

 forgive my noobiness, what is the difference between snn.lib and snd.lib? is
one
 dynamic and the other static?  I only have snn.lib

"newbie-ness". :-)
 According to this post, I will have to buy the CD to get the snd.lib

Yes, looks like it's part of the CD collection. But think of all of the other great tools you get with the CD...! I can appreciate if you're a graduate student, but $25.00 shouldn't get in the way of getting your research done (from a recently graduated UCLA Ph.D. :-) -scooter
Aug 25 2004