boost.thread, DEC C++ (OpenVMS)
Hi, I've just tried to compile boost.thread under OpenVMS and got it working mostly fine, with a few quirks. I'm using Boost 1.30.2 and DEC C++ 6.5 under OpenVMS Alpha 7.1-1H1. OpenVMS provides a compliant(?) pthreads implementation. Note that I did _not_ use Boost.jam (I did try, but couldn't get it going). Compiling the .cpp files under BOOST_ROOT/libs/thread/src works pretty fine, once having defined BOOST_HAS_THREADS, BOOST_HAS_PTHREADS and BOOST_HASTIMEOFDAY on the compiler's commandline. But not for tss.cpp - I get the following error: ------------------------------------------------------------------------- res = pthread_key_create(&m_key, cleanup); .....................................^ %CXX-E-INCOMPATIBLEPRM, argument of type "void (*)(void *)" is incompatible with parameter of type "void (*)(void *) C" at line number 192 in file DISK$USER1:[COMMON.BOOST.LIBS.THREAD.SRC]TSS.CPP;1 ---------------------------------------------------------------------------- --- After some digging around I found out that the error only appears when using the compiler switch "/standard=strict_ansi", which is what I'm using all the time. Now to me it looks like the DEC C++ compiler believes that name mangling isn't the only thing that differs between "C" and "C++" linkage - does anyone here have any comments on that? See below for a small example (and possible way to work around this in the boost.thread implementation): ------ sample.cpp ------- extern "C" { typedef void (*c_linkage_cb_t)(void*); void c_linkage(void (*pfn)(void*)); } inline void cpp_linkage_using_c_typedef(c_linkage_cb_t pfn) { c_linkage(pfn); } inline void cpp_linkage(void (*pfn)(void*)) { c_linkage(pfn); } ---------------- end sample.cpp ------------------- And here's the output from the compiler: $ cxx /standard=strict_ansi t.cpp c_linkage(pfn); ..................^ %CXX-E-INCOMPATIBLEPRM, argument of type "void (*)(void *)" is incompatible with parameter of type "void (*)(void *) C" at line number 19 in file DISK$USER1:[COMMON.BOOST.LIBS.THREAD.SRC]T.CPP;11 I don't know if this is a compiler bug or not, but in order to work around this in boost.thread, wouldn't it be feasible to provide a similar fix to the tss implementation to avoid the compilation problem - e.g. ---- tss.hpp ----- ... extern "C" { typedef int (*pthread_<something>_cb_t)(void*); } ... class tss { ... ... tss(pthread_<something>_cb_t cb) ... --- end tss.hpp ---- Comments appreciated // Johan
"Johan Nilsson"
Hi,
[snip]
------------------------------------------------------------------------- res = pthread_key_create(&m_key, cleanup); .....................................^ %CXX-E-INCOMPATIBLEPRM, argument of type "void (*)(void *)" is
incompatible
with parameter of type "void (*)(void *) C" at line number 192 in file DISK$USER1:[COMMON.BOOST.LIBS.THREAD.SRC]TSS.CPP;1 --------------------------------------------------------------------------
--
---
Reading paragraph 7.5 [Linkage specifications] in the standard it looks like the compiler is right; "... Two function types with different language linkage are distinct types even if they are otherwise identical ...". Or am I (as usual, perhaps) misinterpreting the standard? (How come that the compiler is not complaining when we call C functions from C++ :-) If this is correct, perhaps implementing a fix would be in place? // Johan
In article
Hi,
I've just tried to compile boost.thread under OpenVMS and got it working mostly fine, with a few quirks. I'm using Boost 1.30.2 and DEC C++ 6.5 under OpenVMS Alpha 7.1-1H1. OpenVMS provides a compliant(?) pthreads implementation. Note that I did _not_ use Boost.jam (I did try, but couldn't get it going).
bjam not working on OpenVMS is entirely an access problem. Non of the regular Boost developers have access to OpenVMS on a regular basis. If anyone is interested enough there's only a small amount of work to get it going, with help from OpenVMS people of course ;-) -- -- grafik -- Don't Assume Anything
"Rene Rivera"
In article
, "Johan Nilsson" wrote: Hi,
I've just tried to compile boost.thread under OpenVMS and got it working mostly fine, with a few quirks. I'm using Boost 1.30.2 and DEC C++ 6.5 under OpenVMS Alpha 7.1-1H1. OpenVMS provides a compliant(?) pthreads implementation. Note that I did _not_ use Boost.jam (I did try, but couldn't get it going).
bjam not working on OpenVMS is entirely an access problem. Non of the regular Boost developers have access to OpenVMS on a regular basis. If anyone is interested enough there's only a small amount of work to get it going, with help from OpenVMS people of course ;-)
The major point here wasn't really bjam not working under OpenVMS, it was that Boost.Thread sources weren't compiling (wrong forum?). Mentioning OpenVMS in the ng:s always seems to be a mistake though as no one seems to look in the contents of the posting - or maybe it's just me being too verbose. Anyway, the bjam bootstrap compiles but blows up due to access violation when trying to execute "-fBuild.jam" - probably related to usage of functions not linked in. I'll definitely look into to it and give some more comprehensive description of the problem, but I'm choked for at least a week here with other stuff. With regards to build.jam though, and the 'build-tool' (IIRC) rule, I can say that definitions of define's and include paths must be specified in the form of (something like): /INCLUDE=(dir1, dir2, dir3, ...) /DEFINE=(sym1,sym2=val2, ...) (hence the usage of HDRS and DEFINES in perforce jam). Using one of these more than one time results in only the latest being used. This is all from on top of my head, so the exact details might not be correct. I'll post on the boost.build list as soon as I can get some time to work on this. If you have any specific questions, feel free to mail me directly. Thanks for listening. // Johan
participants (2)
-
Johan Nilsson
-
Rene Rivera