Re: [Mingw-w64-public] Getting actual import name from dynamic library

2019-03-06 Thread LRN
On 07.03.2019 10:11, Пётр Байкалов wrote:
> How do I get the name of library which will be imported? For example, I
> have "libopencv_phase_unwrapping.dll.a" , how do I get
> "libopencv_phase_unwrapping320.dll" from it?

dlltool -I libopencv_phase_unwrapping.dll.a



signature.asc
Description: OpenPGP digital signature
___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


[Mingw-w64-public] Getting actual import name from dynamic library

2019-03-06 Thread Пётр Байкалов
Hello.
How do I get the name of library which will be imported? For example, I
have "libopencv_phase_unwrapping.dll.a" , how do I get
"libopencv_phase_unwrapping320.dll" from it? It is definitely happening
inside linker and it is not accessing the
"libopencv_phase_unwrapping320.dll" (I checked it) so it is done based on
information contained inside .dll.a

-- 
Байкалов Пётр

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


[Mingw-w64-public] [PATCH] Add Microsoft OLE DB driver for SQL server

2019-03-06 Thread Ruslan Garipov

In August of 2011[1] Microsoft announced deprecation of the Microsoft
OLE DB Provider for SQL Server.  But in October of 2017 Microsoft had to
undeprecate[2] OLE DB data access technology releasing the ``Microsoft
OLE DB Driver for SQL Server'' known as ``msoledbsql''.

This commit adds the ``msoledbsql'' API to mingw-w64 -- the only OLE DB
data access solution supported and maintained by Microsoft now.

To provide class and interface identifiers msoledbsql.h in this commit
uses the same technique as, for example, mingw-w64's sqloledb.h file,
i.e. it uses the `DBINITCONSTANTS` guard to define identifiers only in
one module.  Original Microsoft's files (both msoledbsql.h from the new
API and sqloledb.h from Microsoft Windows 10 SDK) use
`__declspec(selectany)` to move that "burden" to the linker.

The original Microsoft's msoledbsql.h uses a Microsoft-specific
"extension", which allows Microsoft Visual C++ compiler to ignore the
following paragraph of the Standard for programming language C++:


10.4.1 Anonymous unions [class.union.anon]
1 ... Each member-declaration in the member-specification of an
anonymous union shall either define a non-static data member or be a
static_assert-declaration. [Note: Nested types, anonymous unions, and
functions cannot be declared within an anonymous union.  —end note]


and successfully compile a code like this:

```
struct SSVARIANT
{
 union
 {
   struct _Time2Val
   {
   } Time2Val;
 };
};
```

GNU C++ and clang++ aren't compatible with such behavior.  Moreover,
those compilers don't allow `typedef`s within anonymous unions (again
because of the [class.union.anon]).  Therefore, I have to break public
API of the original header file related to the `SSVARIANT` structure
type.

Review log: https://sf.net/p/mingw-w64/mailman/mingw-w64-public/thread/
9754bd81-b475-728f-79ce-10e626757a17%40gmail.com/.

[1]: https://blogs.msdn.microsoft.com/sqlnativeclient/2011/08/29/
microsoft-is-aligning-with-odbc-for-native-relational-data-access/
[2]: https://blogs.msdn.microsoft.com/sqlnativeclient/2017/10/06/
announcing-the-new-release-of-ole-db-driver-for-sql-server/

Signed-off-by: Ruslan Garipov 
---
mingw-w64-crt/Makefile.in  |4 +-
mingw-w64-crt/lib32/Makefile.am|1 +
mingw-w64-crt/lib32/msoledbsql.def |   13 +
mingw-w64-crt/lib64/Makefile.am|1 +
mingw-w64-crt/lib64/msoledbsql.def |   13 +
mingw-w64-headers/include/msoledbsql.h | 1452 
6 files changed, 1482 insertions(+), 2 deletions(-)
create mode 100644 mingw-w64-crt/lib32/msoledbsql.def
create mode 100644 mingw-w64-crt/lib64/msoledbsql.def
create mode 100644 mingw-w64-headers/include/msoledbsql.h

diff --git a/mingw-w64-crt/Makefile.in b/mingw-w64-crt/Makefile.in
index 19c2c6f8..28399817 100644
--- a/mingw-w64-crt/Makefile.in
+++ b/mingw-w64-crt/Makefile.in
@@ -7361,7 +7361,7 @@ src_intrincsarm64 =
 @LIB32_TRUE@   lib32/libmsctf.a lib32/libmsctfmonitor.a \
 @LIB32_TRUE@   lib32/libmsdmo.a lib32/libmsdrm.a \
 @LIB32_TRUE@   lib32/libmshtml.a lib32/libmshtmled.a \
-@LIB32_TRUE@   lib32/libmsi.a lib32/libmsimg32.a \
+@LIB32_TRUE@   lib32/libmsi.a lib32/libmsimg32.a lib32/libmsoledbsql.a \
 @LIB32_TRUE@   lib32/libmstask.a lib32/libmsvfw32.a \
 @LIB32_TRUE@   lib32/libmswsock.a lib32/libncrypt.a \
 @LIB32_TRUE@   lib32/libnddeapi.a lib32/libndfapi.a \
@@ -7786,7 +7786,7 @@ src_intrincsarm64 =
 @LIB64_TRUE@   lib64/libmslbui.a lib64/libmsls31.a \
 @LIB64_TRUE@   lib64/libmsmqocm.a lib64/libmsobdl.a \
 @LIB64_TRUE@   lib64/libmsobmain.a lib64/libmsoeacct.a \
-@LIB64_TRUE@   lib64/libmsoe.a lib64/libmsoert2.a \
+@LIB64_TRUE@   lib64/libmsoe.a lib64/libmsoert2.a lib64/libmsoledbsql.a \
 @LIB64_TRUE@   lib64/libmspatcha.a lib64/libmsports.a \
 @LIB64_TRUE@   lib64/libmsrating.a lib64/libmsrle32.a \
 @LIB64_TRUE@   lib64/libmssign32.a lib64/libmssip32.a \
diff --git a/mingw-w64-crt/lib32/Makefile.am b/mingw-w64-crt/lib32/Makefile.am
index 065098f5..cb63da4f 100644
--- a/mingw-w64-crt/lib32/Makefile.am
+++ b/mingw-w64-crt/lib32/Makefile.am
@@ -178,6 +178,7 @@ lib32_DATA += %reldir%/libmshtml.a
 lib32_DATA += %reldir%/libmshtmled.a
 lib32_DATA += %reldir%/libmsi.a
 lib32_DATA += %reldir%/libmsimg32.a
+lib32_DATA += %reldir%/libmsoledbsql.a
 lib32_DATA += %reldir%/libmstask.a
 #lib32_DATA += %reldir%/libmsvcp60.a # Specialized for W32API conditional
 lib32_DATA += %reldir%/libmsvfw32.a
diff --git a/mingw-w64-crt/lib32/msoledbsql.def 
b/mingw-w64-crt/lib32/msoledbsql.def
new file mode 100644
index ..fbea8771
--- /dev/null
+++ b/mingw-w64-crt/lib32/msoledbsql.def
@@ -0,0 +1,13 @@
+;
+; Definition file of msoledbsql.dll
+; Automatic generated by gendef
+; written by Kai Tietz 2008
+;
+LIBRARY "msoledbsql.dll"
+EXPORTS
+DllCanUnloadNow@0
+DllGetClassObject@12
+DllMain@12
+DllRegisterServer@0
+DllUnregisterServer@0
+OpenSqlFilestream@24
diff --git a/mingw-w64-crt/lib64/Makefile.am b/mingw-w64-crt/lib64/Makefile.am
index 0a9c856b..772fb42a 100644
--- a/mingw-w64-crt/

Re: [Mingw-w64-public] [PATCH] Add Microsoft OLE DB driver for SQL server

2019-03-06 Thread Ruslan Garipov
Oops!  I'm really sorry, I've messed up the patch...  I'll resend it  in a 
few minutes.  Sorry.



On March 7, 2019 9:25:22 AM Ruslan Garipov  wrote:


In August of 2011[1] Microsoft announced deprecation of the Microsoft
OLE DB Provider for SQL Server.  But in October of 2017 Microsoft had to
undeprecate[2] OLE DB data access technology releasing the ``Microsoft
OLE DB Driver for SQL Server'' known as ``msoledbsql''.

This commit adds the ``msoledbsql'' API to mingw-w64 -- the only OLE DB
data access solution supported and maintained by Microsoft now.

To provide class and interface identifiers msoledbsql.h in this commit
uses the same technique as, for example, mingw-w64's sqloledb.h file,
i.e. it uses the `DBINITCONSTANTS` guard to define identifiers only in
one module.  Original Microsoft's files (both msoledbsql.h from the new
API and sqloledb.h from Microsoft Windows 10 SDK) use
`__declspec(selectany)` to move that "burden" to the linker.

The original Microsoft's msoledbsql.h uses a Microsoft-specific
"extension", which allows Microsoft Visual C++ compiler to ignore the
following paragraph of the Standard for programming language C++:


10.4.1 Anonymous unions [class.union.anon]
1 ... Each member-declaration in the member-specification of an
anonymous union shall either define a non-static data member or be a
static_assert-declaration. [Note: Nested types, anonymous unions, and
functions cannot be declared within an anonymous union.  —end note]


and successfully compile a code like this:

```
struct SSVARIANT
{
  union
  {
struct _Time2Val
{
} Time2Val;
  };
};
```

GNU C++ and clang++ aren't compatible with such behavior.  Moreover,
those compilers don't allow `typedef`s within anonymous unions (again
because of the [class.union.anon]).  Therefore, I have to break public
API of the original header file related to the `SSVARIANT` structure
type.

Review log: https://sf.net/p/mingw-w64/mailman/mingw-w64-public/thread/
9754bd81-b475-728f-79ce-10e626757a17%40gmail.com/.

[1]: https://blogs.msdn.microsoft.com/sqlnativeclient/2011/08/29/
microsoft-is-aligning-with-odbc-for-native-relational-data-access/
[2]: https://blogs.msdn.microsoft.com/sqlnativeclient/2017/10/06/
announcing-the-new-release-of-ole-db-driver-for-sql-server/

Signed-off-by: Ruslan Garipov 
---
 mingw-w64-crt/Makefile.in  |4 +-
 mingw-w64-crt/lib32/Makefile.am|1 +
 mingw-w64-crt/lib32/msoledbsql.def |   13 +
 mingw-w64-crt/lib64/Makefile.am|1 +
 mingw-w64-crt/lib64/msoledbsql.def |   13 +
 mingw-w64-headers/include/msoledbsql.h | 1454 
 6 files changed, 1484 insertions(+), 2 deletions(-)
 create mode 100644 mingw-w64-crt/lib32/msoledbsql.def
 create mode 100644 mingw-w64-crt/lib64/msoledbsql.def
 create mode 100644 mingw-w64-headers/include/msoledbsql.h






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


[Mingw-w64-public] [PATCH] Add Microsoft OLE DB driver for SQL server

2019-03-06 Thread Ruslan Garipov

In August of 2011[1] Microsoft announced deprecation of the Microsoft
OLE DB Provider for SQL Server.  But in October of 2017 Microsoft had to
undeprecate[2] OLE DB data access technology releasing the ``Microsoft
OLE DB Driver for SQL Server'' known as ``msoledbsql''.

This commit adds the ``msoledbsql'' API to mingw-w64 -- the only OLE DB
data access solution supported and maintained by Microsoft now.

To provide class and interface identifiers msoledbsql.h in this commit
uses the same technique as, for example, mingw-w64's sqloledb.h file,
i.e. it uses the `DBINITCONSTANTS` guard to define identifiers only in
one module.  Original Microsoft's files (both msoledbsql.h from the new
API and sqloledb.h from Microsoft Windows 10 SDK) use
`__declspec(selectany)` to move that "burden" to the linker.

The original Microsoft's msoledbsql.h uses a Microsoft-specific
"extension", which allows Microsoft Visual C++ compiler to ignore the
following paragraph of the Standard for programming language C++:


10.4.1 Anonymous unions [class.union.anon]
1 ... Each member-declaration in the member-specification of an
anonymous union shall either define a non-static data member or be a
static_assert-declaration. [Note: Nested types, anonymous unions, and
functions cannot be declared within an anonymous union.  —end note]


and successfully compile a code like this:

```
struct SSVARIANT
{
 union
 {
   struct _Time2Val
   {
   } Time2Val;
 };
};
```

GNU C++ and clang++ aren't compatible with such behavior.  Moreover,
those compilers don't allow `typedef`s within anonymous unions (again
because of the [class.union.anon]).  Therefore, I have to break public
API of the original header file related to the `SSVARIANT` structure
type.

Review log: https://sf.net/p/mingw-w64/mailman/mingw-w64-public/thread/
9754bd81-b475-728f-79ce-10e626757a17%40gmail.com/.

[1]: https://blogs.msdn.microsoft.com/sqlnativeclient/2011/08/29/
microsoft-is-aligning-with-odbc-for-native-relational-data-access/
[2]: https://blogs.msdn.microsoft.com/sqlnativeclient/2017/10/06/
announcing-the-new-release-of-ole-db-driver-for-sql-server/

Signed-off-by: Ruslan Garipov 
---
mingw-w64-crt/Makefile.in  |4 +-
mingw-w64-crt/lib32/Makefile.am|1 +
mingw-w64-crt/lib32/msoledbsql.def |   13 +
mingw-w64-crt/lib64/Makefile.am|1 +
mingw-w64-crt/lib64/msoledbsql.def |   13 +
mingw-w64-headers/include/msoledbsql.h | 1454 
6 files changed, 1484 insertions(+), 2 deletions(-)
create mode 100644 mingw-w64-crt/lib32/msoledbsql.def
create mode 100644 mingw-w64-crt/lib64/msoledbsql.def
create mode 100644 mingw-w64-headers/include/msoledbsql.h

diff --git a/mingw-w64-crt/Makefile.in b/mingw-w64-crt/Makefile.in
index 19c2c6f8..28399817 100644
--- a/mingw-w64-crt/Makefile.in
+++ b/mingw-w64-crt/Makefile.in
@@ -7361,7 +7361,7 @@ src_intrincsarm64 =
 @LIB32_TRUE@   lib32/libmsctf.a lib32/libmsctfmonitor.a \
 @LIB32_TRUE@   lib32/libmsdmo.a lib32/libmsdrm.a \
 @LIB32_TRUE@   lib32/libmshtml.a lib32/libmshtmled.a \
-@LIB32_TRUE@   lib32/libmsi.a lib32/libmsimg32.a \
+@LIB32_TRUE@   lib32/libmsi.a lib32/libmsimg32.a lib32/libmsoledbsql.a \
 @LIB32_TRUE@   lib32/libmstask.a lib32/libmsvfw32.a \
 @LIB32_TRUE@   lib32/libmswsock.a lib32/libncrypt.a \
 @LIB32_TRUE@   lib32/libnddeapi.a lib32/libndfapi.a \
@@ -7786,7 +7786,7 @@ src_intrincsarm64 =
 @LIB64_TRUE@   lib64/libmslbui.a lib64/libmsls31.a \
 @LIB64_TRUE@   lib64/libmsmqocm.a lib64/libmsobdl.a \
 @LIB64_TRUE@   lib64/libmsobmain.a lib64/libmsoeacct.a \
-@LIB64_TRUE@   lib64/libmsoe.a lib64/libmsoert2.a \
+@LIB64_TRUE@   lib64/libmsoe.a lib64/libmsoert2.a lib64/libmsoledbsql.a \
 @LIB64_TRUE@   lib64/libmspatcha.a lib64/libmsports.a \
 @LIB64_TRUE@   lib64/libmsrating.a lib64/libmsrle32.a \
 @LIB64_TRUE@   lib64/libmssign32.a lib64/libmssip32.a \
diff --git a/mingw-w64-crt/lib32/Makefile.am b/mingw-w64-crt/lib32/Makefile.am
index 065098f5..cb63da4f 100644
--- a/mingw-w64-crt/lib32/Makefile.am
+++ b/mingw-w64-crt/lib32/Makefile.am
@@ -178,6 +178,7 @@ lib32_DATA += %reldir%/libmshtml.a
 lib32_DATA += %reldir%/libmshtmled.a
 lib32_DATA += %reldir%/libmsi.a
 lib32_DATA += %reldir%/libmsimg32.a
+lib32_DATA += %reldir%/libmsoledbsql.a
 lib32_DATA += %reldir%/libmstask.a
 #lib32_DATA += %reldir%/libmsvcp60.a # Specialized for W32API conditional
 lib32_DATA += %reldir%/libmsvfw32.a
diff --git a/mingw-w64-crt/lib32/msoledbsql.def 
b/mingw-w64-crt/lib32/msoledbsql.def
new file mode 100644
index ..fbea8771
--- /dev/null
+++ b/mingw-w64-crt/lib32/msoledbsql.def
@@ -0,0 +1,13 @@
+;
+; Definition file of msoledbsql.dll
+; Automatic generated by gendef
+; written by Kai Tietz 2008
+;
+LIBRARY "msoledbsql.dll"
+EXPORTS
+DllCanUnloadNow@0
+DllGetClassObject@12
+DllMain@12
+DllRegisterServer@0
+DllUnregisterServer@0
+OpenSqlFilestream@24
diff --git a/mingw-w64-crt/lib64/Makefile.am b/mingw-w64-crt/lib64/Makefile.am
index 0a9c856b..772fb42a 100644
--- a/mingw-w64-crt/

Re: [Mingw-w64-public] [PATCH] ctime inline wrapper is also needed for msvcrt 0x1200

2019-03-06 Thread Liu Hao
在 2019/3/7 上午5:11, Martin Storsjö 写道:
> On Wed, 6 Mar 2019, Jacek Caban wrote:
> 
>>
>> It exists in msvcrt.dll that I checked (I think it's from win10). The
>> patch looks good to me.
> 
> _mkgmtime64 appeared in msvcrt.dll in Vista, it's missing in XP.
> 
> // Martin

I think it might be safer to keep the condition but have 0x1200 in place
of 0x1400.

-- 
Best regards,
LH_Mouse



signature.asc
Description: OpenPGP digital signature
___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


Re: [Mingw-w64-public] [PATCH] ctime inline wrapper is also needed for msvcrt 0x1200

2019-03-06 Thread Martin Storsjö

On Wed, 6 Mar 2019, Jacek Caban wrote:


On 3/6/19 3:53 PM, Liu Hao wrote:

在 2019/3/6 22:44, Jacek Caban 写道:

Looks good to me, but it needs msvcrt.def.in adjustment first.
_mkgmtime64 is not available on i386, but it should.



An additional patch has been attached.

But anyway, I think these conditions existed for a reason. I can verify
that they all exist on my Win7, but I am not sure whether they exist
elsewhere.



It exists in msvcrt.dll that I checked (I think it's from win10). The 
patch looks good to me.


_mkgmtime64 appeared in msvcrt.dll in Vista, it's missing in XP.

// Martin

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


Re: [Mingw-w64-public] DLL produced by Mingw-w64 can't be loaded

2019-03-06 Thread David Grayson
Your experience matches mine: the Cygwin ldd utility does not work properly
with MinGW DLLs and prints a bunch of question marks.  There is an ntldd
utility you can use instead.  If it's not on your path already, I'm not
sure the best way to obtain it.  I just use MSYS2, because it's basically a
fork of Cygwin that makes it easy to install MinGW compilers and all the
other open source utilities you would need to build software on Linux,
including ntldd.

--David

On Wed, Mar 6, 2019 at 4:44 AM Matthias Apitz  wrote:

>
>
> Hello,
>
> We have some bigger Java applications running as fat clients on
> Windows PC. These clients are using some Windows services, for example for
> printing, through some DLL written in C++ many years ago and then only
> compiled as 32-bit DLL. Moving forward to OpenJDK 1.8 with a 64-bit JRE
> we now struggle with compiling these DLL to a 64-bit version and I proposed
> here in my company to give mingw-w64 a try. I installed the recent version
> of mingw-w64 into Cygwin and can produce the 64-bit DLL this way (more or
> less without going through all details):
>
> LANG=C export LANG
> CC=/usr/bin/x86_64-w64-mingw32-gcc.exe
> DLL=SiPrinter_x64.dll
>
> for i in *.cpp; do
> ${CC}  -I/home/apitzm/jdk1.8.0_202/include
> -I/home/apitzm/jdk1.8.0_202/include/win32 -c ${i}
> done
>
> ${CC} -shared -L/usr/x86_64-w64-mingw32/sys-root/mingw/lib -o ${DLL} *.o
> -lwinspool -lstdc++ -lgdi32 -lcomdlg32
>
> The resulting SiPrinter_x64.dll causes in Java a class loader exception
> because
> there is someting missing:
>
> $ ldd SiPrinter_x64.dll
> ntdll.dll => /cygdrive/c/Windows/SYSTEM32/ntdll.dll (0x7789)
> kernel32.dll => /cygdrive/c/Windows/system32/kernel32.dll
> (0x)
> KERNELBASE.dll => /cygdrive/c/Windows/system32/KERNELBASE.dll
> (0x7fefd66)
> ??? => ??? (0x6964)
> ^^^   
>
> and the loader exception is:
>
> java.lang.UnsatisfiedLinkError:
> C:\Users\apitzm\vb\SunRise\SRv70\Ausleih-Client\bin\SiPrinter.dll: Can't
> find dependent libraries
> at java.lang.ClassLoader$NativeLibrary.load(Native Method)
> at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1941)
> at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1857)
> at java.lang.Runtime.loadLibrary0(Runtime.java:870)
> at java.lang.System.loadLibrary(System.java:1122)
> at sisis.util.Printer.(Printer.java:67)
> at sisis.lib.drucker.GDIDrucker.(GDIDrucker.java:132)
> at sisis.app.btc.BTCApp.initDrucker(BTCApp.java:3419)
> at sisis.app.btc.BTCApp.(BTCApp.java:2840)
> at sisis.app.btc.BTCApp.main(BTCApp.java:1865)
> Exception: System.loadLibrary()
>
> What is missing in the DLL, also seen as a problem by the ldd-command?
>
> Thanks
>
> matthias
> --
> Matthias Apitz, ✉ g...@unixarea.de, http://www.unixarea.de/
> +49-176-38902045
> Public GnuPG key: http://www.unixarea.de/key.pub
>
>
> ___
> Mingw-w64-public mailing list
> Mingw-w64-public@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
>

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


Re: [Mingw-w64-public] [PATCH] ctime inline wrapper is also needed for msvcrt 0x1200

2019-03-06 Thread Jacek Caban

On 3/6/19 3:53 PM, Liu Hao wrote:

在 2019/3/6 22:44, Jacek Caban 写道:

Looks good to me, but it needs msvcrt.def.in adjustment first.
_mkgmtime64 is not available on i386, but it should.



An additional patch has been attached.

But anyway, I think these conditions existed for a reason. I can verify
that they all exist on my Win7, but I am not sure whether they exist
elsewhere.



It exists in msvcrt.dll that I checked (I think it's from win10). The 
patch looks good to me.



Thanks,

Jacek



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


Re: [Mingw-w64-public] [PATCH] ctime inline wrapper is also needed for msvcrt 0x1200

2019-03-06 Thread Liu Hao
在 2019/3/6 22:44, Jacek Caban 写道:
> Looks good to me, but it needs msvcrt.def.in adjustment first.
> _mkgmtime64 is not available on i386, but it should.
> 
>

An additional patch has been attached.

But anyway, I think these conditions existed for a reason. I can verify
that they all exist on my Win7, but I am not sure whether they exist
elsewhere.


-- 
Best regards,
LH_Mouse
From 5e7a3a990407cbd0d51c226d13dcff724e2d1958 Mon Sep 17 00:00:00 2001
From: Liu Hao 
Date: Wed, 6 Mar 2019 22:50:23 +0800
Subject: [PATCH] crt/msvcrt.def.in: Always declare `_mkgmtime{32,64}`.

Signed-off-by: Liu Hao 
---
 mingw-w64-crt/lib-common/msvcrt.def.in | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/mingw-w64-crt/lib-common/msvcrt.def.in 
b/mingw-w64-crt/lib-common/msvcrt.def.in
index 13115412..449beb0a 100644
--- a/mingw-w64-crt/lib-common/msvcrt.def.in
+++ b/mingw-w64-crt/lib-common/msvcrt.def.in
@@ -869,9 +869,8 @@ _memicmp
 _memicmp_l
 _mkdir
 _mkgmtime
-F_I386(_mkgmtime32)
-F_ARM_ANY(_mkgmtime32)
-F_NON_I386(_mkgmtime64)
+_mkgmtime32
+_mkgmtime64
 _mktemp
 ; _mktemp_s replaced by emu
 F_I386(_mktime32 == mktime)
-- 
2.21.0

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


Re: [Mingw-w64-public] [PATCH] ctime inline wrapper is also needed for msvcrt 0x1200

2019-03-06 Thread Jacek Caban

On 3/6/19 3:33 PM, Liu Hao wrote:

在 2019/3/4 22:54, Jacek Caban 写道:

Hi Johannes,

On 3/3/19 2:48 PM, Johannes Pfau wrote:

When building GCC for msvcrt120, there's a undefined reference to
ctime. It needs to be defined as a wrapper for msvcrt120 as well.
The if condition is slightly complex, but I do not know if I can
modify the if !defined(__CRT__NO_INLINE) || __MSVCRT_VERSION__ >= 0x1400
block instead: This would also change difftime, localtime and so on and
I'm not sure if these should be changed.


I think we should have a single place with inline wrappers for all
versions. Even plain msvcrt.dll could use such inline wrapper. I'd
suggest to move UCRT variant out of #ifdef f__MSVCRT_VERSION__ instead.



Do the attached patches look okay?



Looks good to me, but it needs msvcrt.def.in adjustment first. 
_mkgmtime64 is not available on i386, but it should.



Thanks,

Jacek



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


Re: [Mingw-w64-public] [PATCH] ctime inline wrapper is also needed for msvcrt 0x1200

2019-03-06 Thread Liu Hao
在 2019/3/4 22:54, Jacek Caban 写道:
> Hi Johannes,
> 
> On 3/3/19 2:48 PM, Johannes Pfau wrote:
>> When building GCC for msvcrt120, there's a undefined reference to
>> ctime. It needs to be defined as a wrapper for msvcrt120 as well.
>> The if condition is slightly complex, but I do not know if I can
>> modify the if !defined(__CRT__NO_INLINE) || __MSVCRT_VERSION__ >= 0x1400
>> block instead: This would also change difftime, localtime and so on and
>> I'm not sure if these should be changed.
> 
> 
> I think we should have a single place with inline wrappers for all
> versions. Even plain msvcrt.dll could use such inline wrapper. I'd
> suggest to move UCRT variant out of #ifdef f__MSVCRT_VERSION__ instead.
> 
> 

Do the attached patches look okay?

-- 
Best regards,
LH_Mouse
From 6680efafce500453a68276108d166c034eb8dc53 Mon Sep 17 00:00:00 2001
From: Liu Hao 
Date: Wed, 6 Mar 2019 22:30:38 +0800
Subject: [PATCH 1/2] crt/time.h: Always provide overridden time functions,
 even for MSVCRT.

Signed-off-by: Liu Hao 
---
 mingw-w64-headers/crt/time.h | 12 
 1 file changed, 12 deletions(-)

diff --git a/mingw-w64-headers/crt/time.h b/mingw-w64-headers/crt/time.h
index 73f6264a..447c6b03 100644
--- a/mingw-w64-headers/crt/time.h
+++ b/mingw-w64-headers/crt/time.h
@@ -214,18 +214,7 @@ extern "C" {
 #endif
 
 #ifndef RC_INVOKED
-#if __MSVCRT_VERSION__ < 0x1400
-double __cdecl difftime(time_t _Time1,time_t _Time2);
-char *__cdecl ctime(const time_t *_Time) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
-struct tm *__cdecl gmtime(const time_t *_Time) 
__MINGW_ATTRIB_DEPRECATED_SEC_WARN;
-struct tm *__cdecl localtime(const time_t *_Time) 
__MINGW_ATTRIB_DEPRECATED_SEC_WARN;
-
-time_t __cdecl mktime(struct tm *_Tm);
-time_t __cdecl _mkgmtime(struct tm *_Tm);
-time_t __cdecl time(time_t *_Time);
-#endif
 
-#if !defined(__CRT__NO_INLINE) || __MSVCRT_VERSION__ >= 0x1400
 #if __MSVCRT_VERSION__ >= 0x1400
 #define __TIME_INLINE __mingw_static_ovr
 #else
@@ -250,7 +239,6 @@ __TIME_INLINE struct tm *__cdecl gmtime(const time_t 
*_Time) { return _gmtime32(
 __TIME_INLINE time_t __cdecl _mkgmtime(struct tm *_Tm) { return 
_mkgmtime32(_Tm); }
 __TIME_INLINE time_t __cdecl time(time_t *_Time) { return _time32(_Time); }
 #endif /* !_USE_32BIT_TIME_T */
-#endif /* !__CRT__NO_INLINE */
 
 #ifdef _USE_32BIT_TIME_T
 __forceinline errno_t __cdecl localtime_s(struct tm *_Tm,const time_t *_Time) 
{ return _localtime32_s(_Tm,_Time); }
-- 
2.21.0

From 50a771fda5c9924b7bfb6ab7349cb4a661612dc8 Mon Sep 17 00:00:00 2001
From: Liu Hao 
Date: Wed, 6 Mar 2019 22:31:33 +0800
Subject: [PATCH 2/2] crt/time.h: Adjust a blank line.

Signed-off-by: Liu Hao 
---
 mingw-w64-headers/crt/time.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mingw-w64-headers/crt/time.h b/mingw-w64-headers/crt/time.h
index 447c6b03..f0a83797 100644
--- a/mingw-w64-headers/crt/time.h
+++ b/mingw-w64-headers/crt/time.h
@@ -244,12 +244,12 @@ __TIME_INLINE time_t __cdecl time(time_t *_Time) { return 
_time32(_Time); }
 __forceinline errno_t __cdecl localtime_s(struct tm *_Tm,const time_t *_Time) 
{ return _localtime32_s(_Tm,_Time); }
 __forceinline errno_t __cdecl gmtime_s(struct tm *_Tm, const time_t *_Time)   
{ return _gmtime32_s(_Tm, _Time); }
 __forceinline errno_t __cdecl ctime_s(char *_Buf,size_t _SizeInBytes,const 
time_t *_Time) { return _ctime32_s(_Buf,_SizeInBytes,_Time); }
-
 #else
 __forceinline errno_t __cdecl localtime_s(struct tm *_Tm,const time_t *_Time) 
{ return _localtime64_s(_Tm,_Time); }
 __forceinline errno_t __cdecl gmtime_s(struct tm *_Tm, const time_t *_Time) { 
return _gmtime64_s(_Tm, _Time); }
 __forceinline errno_t __cdecl ctime_s(char *_Buf,size_t _SizeInBytes,const 
time_t *_Time) { return _ctime64_s(_Buf,_SizeInBytes,_Time); }
 #endif
+
 #endif /* !RC_INVOKED */
 
 #if !defined(NO_OLDNAMES) || defined(_POSIX)
-- 
2.21.0

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


[Mingw-w64-public] DLL produced by Mingw-w64 can't be loaded

2019-03-06 Thread Matthias Apitz


Hello,

We have some bigger Java applications running as fat clients on
Windows PC. These clients are using some Windows services, for example for
printing, through some DLL written in C++ many years ago and then only
compiled as 32-bit DLL. Moving forward to OpenJDK 1.8 with a 64-bit JRE
we now struggle with compiling these DLL to a 64-bit version and I proposed
here in my company to give mingw-w64 a try. I installed the recent version
of mingw-w64 into Cygwin and can produce the 64-bit DLL this way (more or
less without going through all details):

LANG=C export LANG
CC=/usr/bin/x86_64-w64-mingw32-gcc.exe
DLL=SiPrinter_x64.dll

for i in *.cpp; do
${CC}  -I/home/apitzm/jdk1.8.0_202/include 
-I/home/apitzm/jdk1.8.0_202/include/win32 -c ${i}
done

${CC} -shared -L/usr/x86_64-w64-mingw32/sys-root/mingw/lib -o ${DLL} *.o 
-lwinspool -lstdc++ -lgdi32 -lcomdlg32

The resulting SiPrinter_x64.dll causes in Java a class loader exception because
there is someting missing:

$ ldd SiPrinter_x64.dll
ntdll.dll => /cygdrive/c/Windows/SYSTEM32/ntdll.dll (0x7789)
kernel32.dll => /cygdrive/c/Windows/system32/kernel32.dll (0x)
KERNELBASE.dll => /cygdrive/c/Windows/system32/KERNELBASE.dll 
(0x7fefd66)
??? => ??? (0x6964)
^^^   

and the loader exception is:

java.lang.UnsatisfiedLinkError: 
C:\Users\apitzm\vb\SunRise\SRv70\Ausleih-Client\bin\SiPrinter.dll: Can't find 
dependent libraries
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1941)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1857)
at java.lang.Runtime.loadLibrary0(Runtime.java:870)
at java.lang.System.loadLibrary(System.java:1122)
at sisis.util.Printer.(Printer.java:67)
at sisis.lib.drucker.GDIDrucker.(GDIDrucker.java:132)
at sisis.app.btc.BTCApp.initDrucker(BTCApp.java:3419)
at sisis.app.btc.BTCApp.(BTCApp.java:2840)
at sisis.app.btc.BTCApp.main(BTCApp.java:1865)
Exception: System.loadLibrary()

What is missing in the DLL, also seen as a problem by the ldd-command?

Thanks

matthias
-- 
Matthias Apitz, ✉ g...@unixarea.de, http://www.unixarea.de/ +49-176-38902045
Public GnuPG key: http://www.unixarea.de/key.pub


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