[Mingw-w64-public] [PATCH 2/2] Added sphelper.h file.

2015-07-28 Thread Jacek Caban
---
 mingw-w64-headers/include/sphelper.h | 77

 1 file changed, 77 insertions(+)
 create mode 100644 mingw-w64-headers/include/sphelper.h


diff --git a/mingw-w64-headers/include/sphelper.h b/mingw-w64-headers/include/sphelper.h
new file mode 100644
index 000..882c8d2
--- /dev/null
+++ b/mingw-w64-headers/include/sphelper.h
@@ -0,0 +1,77 @@
+/**
+ * This file has no copyright assigned and is placed in the Public Domain.
+ * This file is part of the mingw-w64 runtime package.
+ * No warranty is given; refer to the file DISCLAIMER.PD within this package.
+ */
+
+#ifndef SPHelper_h
+#define SPHelper_h
+
+#include 
+
+#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
+
+#include 
+#include 
+/* #include  */
+#include 
+#include 
+#include 
+#include 
+#include 
+/* #include  */
+#include 
+#include 
+#include 
+#include 
+
+inline HRESULT SpGetCategoryFromId(const WCHAR *category_id, ISpObjectTokenCategory **ret, BOOL fCreateIfNotExist = FALSE) {
+ISpObjectTokenCategory *obj_token_cat;
+HRESULT hres;
+
+hres = ::CoCreateInstance(CLSID_SpObjectTokenCategory, NULL, CLSCTX_ALL, __uuidof(ISpObjectTokenCategory),
+(void**)&obj_token_cat);
+if(FAILED(hres))
+return hres;
+
+hres = obj_token_cat->SetId(category_id, fCreateIfNotExist);
+if(FAILED(hres)) {
+obj_token_cat->Release();
+return hres;
+}
+
+*ret = obj_token_cat;
+return S_OK;
+}
+
+inline HRESULT SpEnumTokens(const WCHAR *category_id, const WCHAR *req_attrs, const WCHAR *opt_attrs, IEnumSpObjectTokens **ret) {
+ISpObjectTokenCategory *category;
+HRESULT hres;
+
+hres = SpGetCategoryFromId(category_id, &category);
+if(SUCCEEDED(hres)) {
+hres = category->EnumTokens(req_attrs, opt_attrs, ret);
+category->Release();
+}
+
+return hres;
+}
+
+inline void SpHexFromUlong(WCHAR *str, ULONG ul) {
+_ultow(ul, str, 16);
+}
+
+inline HRESULT SpGetDescription(ISpObjectToken *obj_token, WCHAR **description, LANGID language = GetUserDefaultUILanguage()) {
+WCHAR lang_id[9];
+HRESULT hres;
+
+SpHexFromUlong(lang_id, language);
+hres = obj_token->GetStringValue(lang_id, description);
+if(hres == SPERR_NOT_FOUND)
+hres = obj_token->GetStringValue(NULL, description);
+
+return hres;
+}
+
+#endif
+#endif

--
___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


[Mingw-w64-public] [PATCH 1/2] Added sperror.h file.

2015-07-28 Thread Jacek Caban
---
 mingw-w64-headers/include/sperror.h | 26 ++
 1 file changed, 26 insertions(+)
 create mode 100644 mingw-w64-headers/include/sperror.h


diff --git a/mingw-w64-headers/include/sperror.h b/mingw-w64-headers/include/sperror.h
new file mode 100644
index 000..6376a60
--- /dev/null
+++ b/mingw-w64-headers/include/sperror.h
@@ -0,0 +1,26 @@
+/**
+ * This file has no copyright assigned and is placed in the Public Domain.
+ * This file is part of the mingw-w64 runtime package.
+ * No warranty is given; refer to the file DISCLAIMER.PD within this package.
+ */
+
+#ifndef SPError_h
+#define SPError_h
+
+#include 
+
+#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
+
+#include 
+
+#define FACILITY_SAPI FACILITY_ITF
+#define SAPI_ERROR_BASE 0x5000
+
+#define MAKE_SAPI_HRESULT(sev, err) MAKE_HRESULT(sev, FACILITY_SAPI, err)
+#define MAKE_SAPI_ERROR(err)MAKE_SAPI_HRESULT(SEVERITY_ERROR, err+SAPI_ERROR_BASE)
+#define MAKE_SAPI_SCODE(scode)  MAKE_SAPI_HRESULT(SEVERITY_SUCCESS, scode+SAPI_ERROR_BASE)
+
+#define SPERR_NOT_FOUND MAKE_SAPI_ERROR(0x003a)
+
+#endif
+#endif

--
___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


Re: [Mingw-w64-public] Strange linker error with gcc-5.1 32-bit involving 'virtual thunk'

2015-07-28 Thread Edward Diener
On 7/28/2015 8:49 AM, Ruben Van Boxem wrote:
> 2015-07-28 14:44 GMT+02:00 Edward Diener  >:
>
> On 7/28/2015 8:27 AM, Edward Diener wrote:
>  > Without trying immediately to give specific code for what is a large
>  > project, I am getting linker errors when trying to link a second
> shared
>  > library which depends on a first shared library that has linked
>  > successfully. The errors are:
>  >
>  >
> 
> xml_wgrammar.o:xml_wgrammar.cpp:(.rdata$_ZTVN5boost7archive21xml_archive_exceptionE[__ZTVN5boost7archive21xml_archive_exceptionE]+0x20):
>  > undefined reference to `virtual thunk to
>  > boost::archive::archive_exception::what() const'
>  >
> 
> xml_wgrammar.o:xml_wgrammar.cpp:(.rdata$_ZTCN5boost7archive21xml_archive_exceptionE4_NS0_17archive_exceptionE[__ZTCN5boost7archive21xml_archive_exceptionE4_NS0_17archive_exceptionE]+0x38):
>  > undefined reference to `virtual thunk to
>  > boost::archive::archive_exception::what() const'
>  > collect2.exe: error: ld returned 1 exit status
>  >
>  > The xml_wgrammar.o file is being linked into the second shared
> library.
>  > The xml_wgrammar.cpp file includes xml_archive_exception.hpp. The
>  > xml_archive_exception.hpp includes and derives from
>  > archive_exception.hpp. Both xml_archive_exception and
> archive_exception
>  > have their implementation in the first shared library and have their
>  > necessary implementations exported. The implementation of
>  > archive_exception::what() is exported in the first shared library
> and is
>  > imported when seen by xml_wgrammar.cpp.
>  >
>  > What is so strange is that there is no call to
> archive_exception::what()
>  > in the preprocessed output of xml_wgrammar.cpp.
>  >
>  > Does anybody have any idea what might be going on here before I
> take the
>  > time to reduce this situation into a short enough fragment to
> show in a
>  > subsequent thread in this post ?
>
> After adding an xml_archive_exception::what() implementation which just
> calls its base class archive_exception::what() implementation I now
> receive the linker errors:
>
> xml_wgrammar.o: In function
> `ZN5boost7archive21xml_archive_exceptionD1Ev':
> xml_archive_exception.hpp:34: undefined reference to `vtable for
> boost::archive::xml_archive_exception'
> xml_archive_exception.hpp:34: undefined reference to `vtable for
> boost::archive::xml_archive_exception'
> xml_archive_exception.hpp:34: undefined reference to `vtable for
> boost::archive::xml_archive_exception'
> xml_archive_exception.hpp:34: undefined reference to `VTT for
> boost::archive::xml_archive_exception'
> collect2.exe: error: ld returned 1 exit status
>
> Perhaps this will give someone an idea of what might be happening.
>
>
> You're not linking to the boost_serialization library. At least on my
> system (Linux) boost::archive::{xml_,}archive_exception::what() is
> defined there.

I am working to get the latest version of the Boost serialization 
library from source on Github to build under mingw-64/gcc-5.1 on 
Windows. I am now to the point where I can build the narrow character 
version of the library but when attempting to link the wide character 
version of the library, which depends on classes in the narrow character 
version of the library, I am encountering the errors in this post, as 
specified above. The linker line, from Boost build ( I have elided the 
full paths ), is:

g++ "-Wl,--out-implib,libboost_wserialization-mgw51-d-1_59.dll.a" -o 
"libboost_wserialization-mgw51-d-1_59.dll"  -shared -Wl,--start-group 
"basic_text_wiprimitive.o" "basic_text_woprimitive.o" "text_wiarchive.o" 
"text_woarchive.o" "utf8_codecvt_facet.o" "xml_wgrammar.o" 
"xml_wiarchive.o" "xml_woarchive.o" "codecvt_null.o" 
"libboost_serialization-mgw51-d-1_59.dll.a"  -Wl,-Bstatic  -Wl,-Bdynamic 
  -Wl,--end-group -g -march=i686 -m32

You can see that the I am linking in the boost serialization library 
when attempting to build the wide character version of the library.

>
> Add "-lboost_serialization" to your linker command or do the same
> through your build system.
> Note that Boost has #pragma lib ... to tell MSVC to link the required
> libraries. GCC does not have such a functionality.

Yes, I understand all that.



--
___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


Re: [Mingw-w64-public] Strange linker error with gcc-5.1 32-bit involving 'virtual thunk'

2015-07-28 Thread Ruben Van Boxem
2015-07-28 14:44 GMT+02:00 Edward Diener :

> On 7/28/2015 8:27 AM, Edward Diener wrote:
> > Without trying immediately to give specific code for what is a large
> > project, I am getting linker errors when trying to link a second shared
> > library which depends on a first shared library that has linked
> > successfully. The errors are:
> >
> >
> xml_wgrammar.o:xml_wgrammar.cpp:(.rdata$_ZTVN5boost7archive21xml_archive_exceptionE[__ZTVN5boost7archive21xml_archive_exceptionE]+0x20):
> > undefined reference to `virtual thunk to
> > boost::archive::archive_exception::what() const'
> >
> xml_wgrammar.o:xml_wgrammar.cpp:(.rdata$_ZTCN5boost7archive21xml_archive_exceptionE4_NS0_17archive_exceptionE[__ZTCN5boost7archive21xml_archive_exceptionE4_NS0_17archive_exceptionE]+0x38):
> > undefined reference to `virtual thunk to
> > boost::archive::archive_exception::what() const'
> > collect2.exe: error: ld returned 1 exit status
> >
> > The xml_wgrammar.o file is being linked into the second shared library.
> > The xml_wgrammar.cpp file includes xml_archive_exception.hpp. The
> > xml_archive_exception.hpp includes and derives from
> > archive_exception.hpp. Both xml_archive_exception and archive_exception
> > have their implementation in the first shared library and have their
> > necessary implementations exported. The implementation of
> > archive_exception::what() is exported in the first shared library and is
> > imported when seen by xml_wgrammar.cpp.
> >
> > What is so strange is that there is no call to archive_exception::what()
> > in the preprocessed output of xml_wgrammar.cpp.
> >
> > Does anybody have any idea what might be going on here before I take the
> > time to reduce this situation into a short enough fragment to show in a
> > subsequent thread in this post ?
>
> After adding an xml_archive_exception::what() implementation which just
> calls its base class archive_exception::what() implementation I now
> receive the linker errors:
>
> xml_wgrammar.o: In function `ZN5boost7archive21xml_archive_exceptionD1Ev':
> xml_archive_exception.hpp:34: undefined reference to `vtable for
> boost::archive::xml_archive_exception'
> xml_archive_exception.hpp:34: undefined reference to `vtable for
> boost::archive::xml_archive_exception'
> xml_archive_exception.hpp:34: undefined reference to `vtable for
> boost::archive::xml_archive_exception'
> xml_archive_exception.hpp:34: undefined reference to `VTT for
> boost::archive::xml_archive_exception'
> collect2.exe: error: ld returned 1 exit status
>
> Perhaps this will give someone an idea of what might be happening.
>

You're not linking to the boost_serialization library. At least on my
system (Linux) boost::archive::{xml_,}archive_exception::what() is defined
there.

Add "-lboost_serialization" to your linker command or do the same through
your build system.
Note that Boost has #pragma lib ... to tell MSVC to link the required
libraries. GCC does not have such a functionality.

Ruben
--
___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


Re: [Mingw-w64-public] Strange linker error with gcc-5.1 32-bit involving 'virtual thunk'

2015-07-28 Thread Edward Diener
On 7/28/2015 8:27 AM, Edward Diener wrote:
> Without trying immediately to give specific code for what is a large
> project, I am getting linker errors when trying to link a second shared
> library which depends on a first shared library that has linked
> successfully. The errors are:
>
> xml_wgrammar.o:xml_wgrammar.cpp:(.rdata$_ZTVN5boost7archive21xml_archive_exceptionE[__ZTVN5boost7archive21xml_archive_exceptionE]+0x20):
> undefined reference to `virtual thunk to
> boost::archive::archive_exception::what() const'
> xml_wgrammar.o:xml_wgrammar.cpp:(.rdata$_ZTCN5boost7archive21xml_archive_exceptionE4_NS0_17archive_exceptionE[__ZTCN5boost7archive21xml_archive_exceptionE4_NS0_17archive_exceptionE]+0x38):
> undefined reference to `virtual thunk to
> boost::archive::archive_exception::what() const'
> collect2.exe: error: ld returned 1 exit status
>
> The xml_wgrammar.o file is being linked into the second shared library.
> The xml_wgrammar.cpp file includes xml_archive_exception.hpp. The
> xml_archive_exception.hpp includes and derives from
> archive_exception.hpp. Both xml_archive_exception and archive_exception
> have their implementation in the first shared library and have their
> necessary implementations exported. The implementation of
> archive_exception::what() is exported in the first shared library and is
> imported when seen by xml_wgrammar.cpp.
>
> What is so strange is that there is no call to archive_exception::what()
> in the preprocessed output of xml_wgrammar.cpp.
>
> Does anybody have any idea what might be going on here before I take the
> time to reduce this situation into a short enough fragment to show in a
> subsequent thread in this post ?

After adding an xml_archive_exception::what() implementation which just 
calls its base class archive_exception::what() implementation I now 
receive the linker errors:

xml_wgrammar.o: In function `ZN5boost7archive21xml_archive_exceptionD1Ev':
xml_archive_exception.hpp:34: undefined reference to `vtable for 
boost::archive::xml_archive_exception'
xml_archive_exception.hpp:34: undefined reference to `vtable for 
boost::archive::xml_archive_exception'
xml_archive_exception.hpp:34: undefined reference to `vtable for 
boost::archive::xml_archive_exception'
xml_archive_exception.hpp:34: undefined reference to `VTT for 
boost::archive::xml_archive_exception'
collect2.exe: error: ld returned 1 exit status

Perhaps this will give someone an idea of what might be happening.




--
___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


[Mingw-w64-public] Strange linker error with gcc-5.1 32-bit involving 'virtual thunk'

2015-07-28 Thread Edward Diener
Without trying immediately to give specific code for what is a large 
project, I am getting linker errors when trying to link a second shared 
library which depends on a first shared library that has linked 
successfully. The errors are:

xml_wgrammar.o:xml_wgrammar.cpp:(.rdata$_ZTVN5boost7archive21xml_archive_exceptionE[__ZTVN5boost7archive21xml_archive_exceptionE]+0x20):
 
undefined reference to `virtual thunk to 
boost::archive::archive_exception::what() const'
xml_wgrammar.o:xml_wgrammar.cpp:(.rdata$_ZTCN5boost7archive21xml_archive_exceptionE4_NS0_17archive_exceptionE[__ZTCN5boost7archive21xml_archive_exceptionE4_NS0_17archive_exceptionE]+0x38):
 
undefined reference to `virtual thunk to 
boost::archive::archive_exception::what() const'
collect2.exe: error: ld returned 1 exit status

The xml_wgrammar.o file is being linked into the second shared library. 
The xml_wgrammar.cpp file includes xml_archive_exception.hpp. The 
xml_archive_exception.hpp includes and derives from 
archive_exception.hpp. Both xml_archive_exception and archive_exception 
have their implementation in the first shared library and have their 
necessary implementations exported. The implementation of 
archive_exception::what() is exported in the first shared library and is 
imported when seen by xml_wgrammar.cpp.

What is so strange is that there is no call to archive_exception::what() 
in the preprocessed output of xml_wgrammar.cpp.

Does anybody have any idea what might be going on here before I take the 
time to reduce this situation into a short enough fragment to show in a 
subsequent thread in this post ?


--
___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


Re: [Mingw-w64-public] winpthreads

2015-07-28 Thread Alexey Pavlov

> 28 июля 2015 г., в 7:09, Alexey Pavlov  написал(а):
> 
> Hi, guys!
> 
> Our users (MSYS2) report lot of crashes in different applications. We found 
> that that crash are happen after upgrading winpthreads and caused one or both 
> of two commits:
> Rewrite the pthread spin lock implementation - 
> https://github.com/msys2/mingw-w64/commit/249898d9ae310959116efa333e4e3e690cf97452
>  
> 
> Rewrite the mutex implementation for better performance - 
> https://github.com/msys2/mingw-w64/commit/1968e60cd5d59727bb325d5b69c8f0d7a2f1fe1b
>  
> 
> 
> I have no yet good testcase. This is GDB backtrace from one of our users 
> https://gist.github.com/achadwick/01c6a1b519a36dcdbe0a 
> 
> 
> Regards,
> Alexey.
> 
> 

For debugging issue can be used OpmeMP test
https://github.com/niXman/mingw-builds/blob/master/tests/omp_test.c 


Build it with «gcc omp_test.c -fopenmp -o omp_test.exe» and run.

Regards,
Alexey.--
___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public