This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: Howto get basic STL running
- From: eibach at gdsys dot de
- To: ecos-discuss at sources dot redhat dot com
- Date: 20 Jan 2004 07:20:45 UT
- Subject: Re: [ECOS] Howto get basic STL running
Hello,
> Hello Dirk,
> would you be so kind to post an how-to for the community?
>
> Thanks in advance.
> Giovanni P.
You just have to download STLPort library for www.stlport.org
Then include it into your project.
I have made some hacks, so that it compiles. Most of them are quick and dirty, but they work fine for me. Hopefully someone more gifted than me can improve them and feed them back to the list.
I have attached a patch (against STLPort 4.6).
Regards,
Dirk
diff -Naur stlport_4_6/stlport/cstdio stlport_ecos/stlport/cstdio
--- stlport_4_6/stlport/cstdio 2003-07-21 04:36:42.000000000 +0200
+++ stlport_ecos/stlport/cstdio 2003-12-05 15:13:15.966081600 +0100
using _STLP_VENDOR_CSTD::perror;
using _STLP_VENDOR_CSTD::printf;
using _STLP_VENDOR_CSTD::puts;
+# if (!defined (__ECOS__))
using _STLP_VENDOR_CSTD::remove;
using _STLP_VENDOR_CSTD::rename;
+# endif
using _STLP_VENDOR_CSTD::rewind;
using _STLP_VENDOR_CSTD::scanf;
using _STLP_VENDOR_CSTD::setbuf;
using _STLP_VENDOR_CSTD::setvbuf;
using _STLP_VENDOR_CSTD::sprintf;
using _STLP_VENDOR_CSTD::sscanf;
+# if (!defined (__ECOS__))
using _STLP_VENDOR_CSTD::tmpfile;
using _STLP_VENDOR_CSTD::tmpnam;
+#endif
using _STLP_VENDOR_CSTD::ungetc;
using _STLP_VENDOR_CSTD::vfprintf;
using _STLP_VENDOR_CSTD::vprintf;
diff -Naur stlport_4_6/stlport/new.h stlport_ecos/stlport/new.h
--- stlport_4_6/stlport/new.h 2003-10-09 06:30:02.000000000 +0200
+++ stlport_ecos/stlport/new.h 2004-01-19 15:59:02.767190400 +0100
# define _STLP_DONT_POP_0x848
# endif
+#ifdef __ECOS__
+// Default placement versions of operator new.
+inline void* operator new(size_t, void* __p) throw() { return __p; }
+inline void* operator new[](size_t, void* __p) throw() { return __p; }
+
+// Default placement versions of operator delete.
+inline void operator delete (void*, void*) throw() { };
+inline void operator delete[](void*, void*) throw() { };
+#else
# ifndef _STLP_WINCE
# if defined (__BORLANDC__)
# include <new.>
# include _STLP_NATIVE_CPP_RUNTIME_HEADER(new.h)
# endif
# endif
-# endif /* STL_WINCE */
+# endif
+#endif // __ECOS__
# if (_STLP_OUTERMOST_HEADER_ID == 0x848)
# if ! defined (_STLP_DONT_POP_0x848)
diff -Naur stlport_4_6/stlport/stl/_alloc.h stlport_ecos/stlport/stl/_alloc.h
--- stlport_4_6/stlport/stl/_alloc.h 2003-10-21 06:45:48.000000000 +0200
+++ stlport_ecos/stlport/stl/_alloc.h 2003-12-08 08:22:51.570681600 +0100
}
};
-
+#ifndef __ECOS__
// New-based allocator. Typically slower than default alloc below.
// Typically thread-safe and more storage efficient.
class _STLP_CLASS_DECLSPEC __new_alloc {
static void* _STLP_CALL allocate(size_t __n) { return __stl_new(__n); }
static void _STLP_CALL deallocate(void* __p, size_t) { __stl_delete(__p); }
};
-
+#endif
// Allocator adaptor to check size arguments for debugging.
// Reports errors using assert. Checking can be disabled with
diff -Naur stlport_4_6/stlport/stl/_config.h stlport_ecos/stlport/stl/_config.h
--- stlport_4_6/stlport/stl/_config.h 2003-11-01 00:53:48.000000000 +0100
+++ stlport_ecos/stlport/stl/_config.h 2003-12-08 08:43:41.457931200 +0100
/* if using stlport:: namespace or if C library stuff is not in vendor's std::,
* try importing 'em.
* MSVC has ambiguity problem when we try to import C-style std:: stuff back into global namespace */
-# if defined (_STLP_USE_NAMESPACES) && /* ! defined (_STLP_OWN_IOSTREAMS) && */ \
+# if defined (_STLP_USE_NAMESPACES) && /* ! defined (_STLP_OWN_IOSTREAMS) && */ !defined (__ECOS__) &&\
( defined(_STLP_USE_OWN_NAMESPACE) || defined (_STLP_VENDOR_GLOBAL_CSTD))
# define _STLP_IMPORT_VENDOR_CSTD 1
# endif
diff -Naur stlport_4_6/stlport/stl/_threads.h stlport_ecos/stlport/stl/_threads.h
--- stlport_4_6/stlport/stl/_threads.h 2003-10-22 20:59:00.000000000 +0200
+++ stlport_ecos/stlport/stl/_threads.h 2003-12-08 08:18:43.113417600 +0100
# else
# if defined (_STLP_USE_NAMESPACES) && ! defined (_STLP_VENDOR_GLOBAL_CSTD)
// using _STLP_VENDOR_CSTD::size_t;
-using namespace _STLP_VENDOR_CSTD;
+//using namespace _STLP_VENDOR_CSTD;
# endif
typedef size_t __stl_atomic_t;
#endif
diff -Naur stlport_4_6/stlport/stl_user_config.h stlport_ecos/stlport/stl_user_config.h
--- stlport_4_6/stlport/stl_user_config.h 2003-07-23 22:51:52.000000000 +0200
+++ stlport_ecos/stlport/stl_user_config.h 2004-01-05 15:19:22.164264000 +0100
* Use this switch for embedded systems where no iostreams are available
* at all. STLport own iostreams will also get disabled automatically then.
*/
-// # define _STLP_NO_IOSTREAMS 1
+# define _STLP_NO_IOSTREAMS 1
/*
* Set _STLP_DEBUG to turn the "Debug Mode" on.
* Please do not forget to link proper STLport library flavor
* (e.g libstlport_gcc_stldebug.a) when you set this flag in STLport iostreams mode.
*/
-//#define _STLP_DEBUG 1
+// #define _STLP_DEBUG 1
/*
//==========================================================
+#define __ECOS__
+#define __CYGWIN__
+#define _STLP_NO_NEW_C_HEADERS
+#define _STLP_NO_NEW_NEW_HEADER
+#define _STLP_NO_OWN_NAMESPACE
+#define _STLP_USE_MALLOC
+#define _STLP_NODE_ALLOC_USE_MALLOC
+#define _STLP_NO_WCHAR_T
+//#define _STLP_DEBUG_ALLOC
+
// Local Variables:
// mode:C++
// End:
--
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss