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

2019-03-08 Thread Liu Hao
在 2019/3/7 13:08, Ruslan Garipov 写道:
> Signed-off-by: Ruslan Garipov 
> ---
> mingw-w64-crt/Makefile.in  |    4 +-

Next time, please do not include the diff of generated files.
'Makefile.in' is generated from 'Makefile.am' using `autoreconf -if' so
only the diff of 'Makefile.am' need appear in the patch.  I removed this
from the patch.

For this patch there is no modification to 'Makefile.am', however.

> 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
> 

> +#ifndef __cplusplus
> +  MSOLEDBSQL_H_DECL_SSVARIANT_STRUCTS;
> +#endif
> +struct SSVARIANT {
> +  SSVARTYPE vt;
> +  DWORD dwReserved1;
> +  DWORD dwReserved2;
> +  /* For C++ code (`-x c++`/`-Tp`) we may move the declarations here.  This, 
> at
> +   * least, limits scope of the declarations to the `SSVARIANT` structure, 
> if we
> +   * compare declaration of the structures at the global scope (as it's made 
> for
> +   * C code).  Both variants break public API of the original header file, 
> but
> +   * unfortunately that's unavoidable. */
> +#ifdef __cplusplus
> +  MSOLEDBSQL_H_DECL_SSVARIANT_STRUCTS;
> +#endif

There shall be no semicolons following
`MSOLEDBSQL_H_DECL_SSVARIANT_STRUCTS`. I removed them, too.

Thank you very much for the work and the discussion. The patch looks
good now.  I amended the patch and pushed it.


-- 
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-08 Thread Johannes Pfau


Am 08.03.19 um 22:27 schrieb Johannes Pfau:

Am 07.03.19 um 15:48 schrieb Liu Hao:

在 2019/3/7 17:45, Jacek Caban 写道:

Note that when doing 32-bit builds, _USE_32BIT_TIME_T will be most
likely defined so this code path will not be used. Currently (although
it might be improved in the future), one has to define
__MINGW_USE_VC2005_COMPAT to use 64-bit time_t, and it's the only 
config

that would break on XP.


Current code, instead of load failure, will call a function with wrong
arguments and will likely corrupt stack. I don't think that's something
we want to preserve. If we really want to support this case properly,
we'd need _mkgmtime64 compat implementation inside libmsvcrt.a.



Indeed, the actual `ctime()` etc. exported from the DLL are always
32-bit or 64-bit, so we can't support both without tampering with the
source code rather than the library.

I pushed these three patches.


Thanks a lot! I can confirm that this fixes the GCC bootstrap problems.


Sorry, this was supposed to go to the mailing list


Best regards,

Johannes



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


Re: [Mingw-w64-public] C++ code using Microsoft ATL (Active Template Library)

2019-03-08 Thread Liu Hao
在 2019/3/8 21:49, Matthias Apitz 写道:
> El día Friday, March 08, 2019 a las 09:00:27PM +0800, Liu Hao escribió:
> 
> Thanks for the pointer. All that DLL is only made from one small C++
> file and when I do read it right it does not make use of ATL, but only
> of a CString class provided there. Maybe we should rewrite it better
> with std::string? It serves only for the Java app to write bytes to some
> serial device.
> 

`std::string` is provided by libstdc++ rather than mingw-w64. As long as
you don't pass it around to DLLs compiled with a different standard
library (e.g. the one from MSVC) it is probably OK.


-- 
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] C++ code using Microsoft ATL (Active Template Library)

2019-03-08 Thread Matthias Apitz
El día Friday, March 08, 2019 a las 09:00:27PM +0800, Liu Hao escribió:

> 在 2019/3/8 20:43, Matthias Apitz 写道:
> > 
> > Hello,
> > 
> > The next DLL I have to recompile for 64-bit was written on top of some
> > packages Microsoft ATL (Active Template Library), which includes the
> > header atlbase.h with VC++. Is there anything for this in MinGW?
> > 
> 
> No. But you may want to have a look at the one in ReactOS [1] which is
> supposed to compile with both MSVC and GCC.
> 
> [1] https://github.com/reactos/reactos/blob/master/sdk/lib/atl/atlbase.h

Thanks for the pointer. All that DLL is only made from one small C++
file and when I do read it right it does not make use of ATL, but only
of a CString class provided there. Maybe we should rewrite it better
with std::string? It serves only for the Java app to write bytes to some
serial device.

matthias

Serout.cpp

#include 
#include 
#include "sisis_lib_serout_Serout.h"

bool WriteComPort(CString PortSpecifier, CString portInformation, jbyte* data, 
jsize size);
void AdustDCB(CString portInformation, DCB* dcb);

JNIEXPORT jint JNICALL Java_sisis_lib_serout_Serout_SeroutC
  (JNIEnv* env, jclass c, jstring jPort, jbyteArray array)
{
CString portSpecifier((char *) env->GetStringChars(jPort, 0));
CString portInformation = portSpecifier.Right(portSpecifier.GetLength() 
- portSpecifier.Find(":", 0) - 1);

portSpecifier.Truncate(portSpecifier.Find(":", 0));

jbyte* data = env->GetByteArrayElements(array, NULL);
jsize size = env->GetArrayLength(array);
if (data != NULL && size > 0) {
bool res = WriteComPort(portSpecifier, portInformation, data, 
size);
env->ReleaseByteArrayElements(array, data, JNI_ABORT);
}
return JNI_FALSE;
}

bool WriteComPort(CString PortSpecifier, CString portInformation, jbyte* data, 
jsize size)
{
DCB dcb;
DWORD   byteswritten;
HANDLE hPort = CreateFile(
PortSpecifier,
GENERIC_WRITE,
0,
NULL,
OPEN_EXISTING,
0,
NULL
);

if (!GetCommState(hPort, ))
return   false;

AdustDCB(portInformation, );

if (!SetCommState(hPort, ))
return   false;

bool retVal = WriteFile(hPort, data, size, , NULL);
CloseHandle(hPort); //close   the   handle  
 
return   retVal;
}

void AdustDCB(CString properties, DCB* dcb)
{
int curpos = 0;
CString token;

token = properties.Tokenize(",", curpos);
if (!token.IsEmpty()) {
dcb->BaudRate = _ttoi(token);
}

token = properties.Tokenize(",", curpos);
if (!token.IsEmpty()) {
// Parity(N = No, E = Even, O = Odd, M = Mark, S = Space
if (token.Compare("N") == NULL) {
dcb->Parity = NOPARITY;
}
else if (token == 'E') {
dcb->Parity = EVENPARITY;
}
else if (token == 'O') {
dcb->Parity = ODDPARITY;
}
else if (token == 'M') {
dcb->Parity = MARKPARITY;
}
else if (token == 'S') {
dcb->Parity = SPACEPARITY;
}
}

token = properties.Tokenize(",", curpos);
if (!token.IsEmpty()) {
// ByteSize
dcb->ByteSize = _ttoi(token);
}

token = properties.Tokenize(",", curpos);
if (!token.IsEmpty()) {
// StopBit
dcb->ByteSize = _ttoi(token);
}
}
-- 
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


Re: [Mingw-w64-public] C++ code using Microsoft ATL (Active Template Library)

2019-03-08 Thread Liu Hao
在 2019/3/8 20:43, Matthias Apitz 写道:
> 
> Hello,
> 
> The next DLL I have to recompile for 64-bit was written on top of some
> packages Microsoft ATL (Active Template Library), which includes the
> header atlbase.h with VC++. Is there anything for this in MinGW?
> 

No. But you may want to have a look at the one in ReactOS [1] which is
supposed to compile with both MSVC and GCC.

[1] https://github.com/reactos/reactos/blob/master/sdk/lib/atl/atlbase.h

> For more details see also:
> https://stackoverflow.com/questions/3898287/c-include-atlbase-h-is-not-found
> 
> Thanks
> 
>   matthias
> 


-- 
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


[Mingw-w64-public] C++ code using Microsoft ATL (Active Template Library)

2019-03-08 Thread Matthias Apitz

Hello,

The next DLL I have to recompile for 64-bit was written on top of some
packages Microsoft ATL (Active Template Library), which includes the
header atlbase.h with VC++. Is there anything for this in MinGW?

For more details see also:
https://stackoverflow.com/questions/3898287/c-include-atlbase-h-is-not-found

Thanks

matthias
-- 
Matthias Apitz, ✉ g...@unixarea.de, http://www.unixarea.de/ +49-176-38902045
Public GnuPG key: http://www.unixarea.de/key.pub
October, 7 -- The GDR was different: Peace instead of Bundeswehr and wars, 
Druschba
instead of Nazis, to live instead of to survive.


___
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 for finally fix fesetenv

2019-03-08 Thread Liu Hao
在 2019/3/8 15:10, Zidane Sama 写道:
> Something like this?
> 

Thanks. This testcase has been verified. I copied it into my commit
message and pushed my patch.


-- 
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