summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Greer <perl@greerga.m-l.org>2011-06-01 21:15:21 -0400
committerGeorge Greer <perl@greerga.m-l.org>2011-06-01 21:19:54 -0400
commit3706fcb579e6b4ebd14e943fbe38d65abfda56e1 (patch)
tree28af3cf55f2225b07cdf522ef7ab0280c714ef97
parentbf8fb5ebdd40c5dae131bdfb08395be447f81573 (diff)
downloadperl-greerga/cygwin_g++.tar.gz
Fix build under Cygwin with g++. Not suitable for integration into blead.smoke-me/greerga/cygwin_g++greerga/cygwin_g++
-rw-r--r--cpan/Win32/Win32.xs10
-rw-r--r--cpan/Win32API-File/File.xs15
-rw-r--r--cpan/Win32API-File/typemap1
-rw-r--r--cygwin/cygwin.c2
-rw-r--r--ext/SDBM_File/sdbm/sdbm.h12
-rw-r--r--ext/Win32CORE/Win32CORE.c2
6 files changed, 25 insertions, 17 deletions
diff --git a/cpan/Win32/Win32.xs b/cpan/Win32/Win32.xs
index 8af0e888c6..403b30c0ce 100644
--- a/cpan/Win32/Win32.xs
+++ b/cpan/Win32/Win32.xs
@@ -1,3 +1,4 @@
+#include <wchar.h>
#include <wctype.h>
#include <windows.h>
#include <shlobj.h>
@@ -236,7 +237,7 @@ get_unicode_env(pTHX_ WCHAR *name)
pfnCreateEnvironmentBlock(&env, token, FALSE))
{
size_t name_len = wcslen(name);
- WCHAR *entry = env;
+ WCHAR *entry = (WCHAR *)env;
while (*entry) {
size_t i;
size_t entry_len = wcslen(entry);
@@ -812,12 +813,13 @@ XS(w32_GuidGen)
{
dXSARGS;
GUID guid;
- char szGUID[50] = {'\0'};
- HRESULT hr = CoCreateGuid(&guid);
+ char szGUID[50] = {'\0'};
+ HRESULT hr = CoCreateGuid(&guid);
+ const CLSID clsid = guid;
if (SUCCEEDED(hr)) {
LPOLESTR pStr = NULL;
- if (SUCCEEDED(StringFromCLSID(&guid, &pStr))) {
+ if (SUCCEEDED(StringFromCLSID(clsid, &pStr))) {
WideCharToMultiByte(CP_ACP, 0, pStr, (int)wcslen(pStr), szGUID,
sizeof(szGUID), NULL, NULL);
CoTaskMemFree(pStr);
diff --git a/cpan/Win32API-File/File.xs b/cpan/Win32API-File/File.xs
index 7dbe783c0e..3d0a1e155e 100644
--- a/cpan/Win32API-File/File.xs
+++ b/cpan/Win32API-File/File.xs
@@ -16,6 +16,7 @@
#define WIN32_LEAN_AND_MEAN /* Tell windows.h to skip much */
#include <windows.h>
#include <winioctl.h>
+#include <wchar.h>
/*CONSTS_DEFINED*/
@@ -26,7 +27,7 @@
#define oDWORD DWORD
#if (PERL_REVISION <= 5 && PERL_VERSION < 5) || defined(__CYGWIN__)
-# define win32_get_osfhandle _get_osfhandle
+# define win32_get_osfhandle get_osfhandle
# ifdef __CYGWIN__
# define win32_open_osfhandle(handle,mode) \
(Perl_croak(aTHX_ "_open_osfhandle not implemented on Cygwin!"), -1)
@@ -142,13 +143,13 @@ CreateFileA( sPath, uAccess, uShare, pSecAttr, uCreate, uFlags, hModel )
char * sPath
DWORD uAccess
DWORD uShare
- void * pSecAttr
+ _SECURITY_ATTRIBUTES * pSecAttr
DWORD uCreate
DWORD uFlags
HANDLE hModel
CODE:
RETVAL= CreateFileA( sPath, uAccess, uShare,
- pSecAttr, uCreate, uFlags, hModel );
+ (_SECURITY_ATTRIBUTES *)pSecAttr, uCreate, uFlags, hModel );
if( INVALID_HANDLE_VALUE == RETVAL ) {
SaveErr( 1 );
XSRETURN_NO;
@@ -164,7 +165,7 @@ CreateFileW( swPath, uAccess, uShare, pSecAttr, uCreate, uFlags, hModel )
WCHAR * swPath
DWORD uAccess
DWORD uShare
- void * pSecAttr
+ SECURITY_ATTRIBUTES * pSecAttr
DWORD uCreate
DWORD uFlags
HANDLE hModel
@@ -234,7 +235,7 @@ DeviceIoControl( hDevice, uIoControlCode, pInBuf, lInBuf, opOutBuf, lOutBuf, olR
char * opOutBuf = NO_INIT
DWORD lOutBuf = init_buf_l($arg);
oDWORD &olRetBytes
- void * pOverlapped
+ LPOVERLAPPED pOverlapped
CODE:
if( NULL != pInBuf ) {
if( 0 == lInBuf ) {
@@ -545,7 +546,7 @@ ReadFile( hFile, opBuffer, lBytes, olBytesRead, pOverlapped )
BYTE * opBuffer = NO_INIT
DWORD lBytes = init_buf_l($arg);
oDWORD &olBytesRead
- void * pOverlapped
+ LPOVERLAPPED pOverlapped
CODE:
grow_buf_l( opBuffer,ST(1),BYTE *, lBytes,ST(2) );
/* Don't read more bytes than asked for if buffer is already big: */
@@ -630,7 +631,7 @@ WriteFile( hFile, pBuffer, lBytes, ouBytesWritten, pOverlapped )
BYTE * pBuffer
DWORD lBytes = init_buf_l($arg);
oDWORD &ouBytesWritten
- void * pOverlapped
+ LPOVERLAPPED pOverlapped
CODE:
/* SvCUR(ST(1)) might "panic" if pBuffer isn't valid */
if( 0 == lBytes ) {
diff --git a/cpan/Win32API-File/typemap b/cpan/Win32API-File/typemap
index 2134712109..ff77ec56be 100644
--- a/cpan/Win32API-File/typemap
+++ b/cpan/Win32API-File/typemap
@@ -15,6 +15,7 @@ ValEntA * T_BUF
ValEntW * T_BUF
SECURITY_DESCRIPTOR * T_BUF
SECURITY_ATTRIBUTES * T_BUF
+_SECURITY_ATTRIBUTES * T_BUF
LPOVERLAPPED T_BUF
LONG * T_IVBUF
DWORD * T_UVBUF
diff --git a/cygwin/cygwin.c b/cygwin/cygwin.c
index aa6938d279..b55ce74c94 100644
--- a/cygwin/cygwin.c
+++ b/cygwin/cygwin.c
@@ -194,7 +194,7 @@ XS(XS_Cygwin_winpid_to_pid)
pid = (pid_t)SvIV(ST(0));
- if ((RETVAL = cygwin32_winpid_to_pid(pid)) > 0) {
+ if ((RETVAL = cygwin_winpid_to_pid(pid)) > 0) {
XSprePUSH; PUSHi((IV)RETVAL);
XSRETURN(1);
}
diff --git a/ext/SDBM_File/sdbm/sdbm.h b/ext/SDBM_File/sdbm/sdbm.h
index 53fc366801..28e5e873f6 100644
--- a/ext/SDBM_File/sdbm/sdbm.h
+++ b/ext/SDBM_File/sdbm/sdbm.h
@@ -179,10 +179,14 @@ extern long sdbm_hash proto((const char *, int));
# define realloc Perl_realloc
# define free Perl_mfree
-Malloc_t Perl_malloc proto((MEM_SIZE nbytes));
-Malloc_t Perl_calloc proto((MEM_SIZE elements, MEM_SIZE size));
-Malloc_t Perl_realloc proto((Malloc_t where, MEM_SIZE nbytes));
-Free_t Perl_mfree proto((Malloc_t where));
+#ifdef __cplusplus
+#define EXTERN_C extern "C"
+#endif
+
+EXTERN_C Malloc_t Perl_malloc proto((MEM_SIZE nbytes));
+EXTERN_C Malloc_t Perl_calloc proto((MEM_SIZE elements, MEM_SIZE size));
+EXTERN_C Malloc_t Perl_realloc proto((Malloc_t where, MEM_SIZE nbytes));
+EXTERN_C Free_t Perl_mfree proto((Malloc_t where));
#endif /* MYMALLOC */
#ifdef I_STRING
diff --git a/ext/Win32CORE/Win32CORE.c b/ext/Win32CORE/Win32CORE.c
index 9863b5b51a..31b3199380 100644
--- a/ext/Win32CORE/Win32CORE.c
+++ b/ext/Win32CORE/Win32CORE.c
@@ -61,7 +61,7 @@ FORWARD(Sleep)
#undef FORWARD
-XS(boot_Win32CORE)
+EXTERN_C XS(boot_Win32CORE)
{
/* This function only exists because writemain.SH, lib/ExtUtils/Embed.pm
* and win32/buildext.pl will all generate references to it. The function