Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDoug Schaefer2004-11-18 11:11:50 -0500
committerDoug Schaefer2004-11-18 11:11:50 -0500
commit8c69def99480bf082931cb29bc304a6c67d243d1 (patch)
tree49d3b6525ebfbc562d67e41baec27492e8eb39a0 /core/org.eclipse.cdt.core.win32/library
parent548574d7fdd9ee14ab82ac5d2232f187b5edbd2b (diff)
downloadorg.eclipse.cdt-8c69def99480bf082931cb29bc304a6c67d243d1.tar.gz
org.eclipse.cdt-8c69def99480bf082931cb29bc304a6c67d243d1.tar.xz
org.eclipse.cdt-8c69def99480bf082931cb29bc304a6c67d243d1.zip
Updated the Windows spawner DLL to build using MinGW gcc.
Diffstat (limited to 'core/org.eclipse.cdt.core.win32/library')
-rw-r--r--core/org.eclipse.cdt.core.win32/library/Makefile35
-rw-r--r--core/org.eclipse.cdt.core.win32/library/Win32ProcessEx.c21
-rw-r--r--core/org.eclipse.cdt.core.win32/library/iostream.c8
-rw-r--r--core/org.eclipse.cdt.core.win32/library/spawner.c2
4 files changed, 50 insertions, 16 deletions
diff --git a/core/org.eclipse.cdt.core.win32/library/Makefile b/core/org.eclipse.cdt.core.win32/library/Makefile
new file mode 100644
index 0000000000..017913780f
--- /dev/null
+++ b/core/org.eclipse.cdt.core.win32/library/Makefile
@@ -0,0 +1,35 @@
+# makefile for libspawner.so
+
+ifeq ($(JAVA_HOME),)
+$(warning JAVA_HOME not set in environment)
+endif
+
+# Defaults which can be overridden.
+OS = win32
+ARCH = x86
+
+JDK_INCLUDES= $(JAVA_HOME)/include
+JDK_OS_INCLUDES= $(JAVA_HOME)/include/$(OS)
+
+CC=gcc
+CPPFLAGS = -I. -I$(JDK_INCLUDES) -I$(JDK_OS_INCLUDES)
+CFLAGS += -D_UNICODE -Dwchar_t=short
+
+INSTALL_DIR = ../os/$(OS)/$(ARCH)
+
+LIB_NAME_SPAWNER = spawner.dll
+LIB_NAME_FULL_SPAWNER = $(INSTALL_DIR)/spawner.dll
+OBJS_SPAWNER=StdAfx.o Win32ProcessEx.o iostream.o raise.o spawner.o
+
+OBJS = $(OBJS_SPAWNER)
+
+all: $(LIB_NAME_FULL_SPAWNER)
+
+rebuild: clean all
+
+$(LIB_NAME_FULL_SPAWNER) : $(OBJS_SPAWNER)
+ mkdir -p $(INSTALL_DIR)
+ $(CC) -Wl,--kill-at -g -shared -o $(LIB_NAME_FULL_SPAWNER) $(OBJS_SPAWNER)
+
+clean :
+ $(RM) $(OBJS_SPAWNER) $(LIB_NAME_FULL_SPAWNER)
diff --git a/core/org.eclipse.cdt.core.win32/library/Win32ProcessEx.c b/core/org.eclipse.cdt.core.win32/library/Win32ProcessEx.c
index c7e30b2bbd..af3d1f2a95 100644
--- a/core/org.eclipse.cdt.core.win32/library/Win32ProcessEx.c
+++ b/core/org.eclipse.cdt.core.win32/library/Win32ProcessEx.c
@@ -19,7 +19,6 @@
#include <process.h>
#include "Spawner.h"
-
#include "jni.h"
#include "io.h"
@@ -150,9 +149,9 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec0
// Create pipe names
EnterCriticalSection(&cs);
- _stprintf(inPipeName, _T("\\\\.\\pipe\\stdin%08i%010i"), pid, nCounter);
- _stprintf(outPipeName, _T("\\\\.\\pipe\\stdout%08i%010i"), pid, nCounter);
- _stprintf(errPipeName, _T("\\\\.\\pipe\\stderr%08i%010i"), pid, nCounter);
+ _stprintf(inPipeName, L"\\\\.\\pipe\\stdin%08i%010i", pid, nCounter);
+ _stprintf(outPipeName, L"\\\\.\\pipe\\stdout%08i%010i", pid, nCounter);
+ _stprintf(errPipeName, L"\\\\.\\pipe\\stderr%08i%010i", pid, nCounter);
nLocalCounter = nCounter;
++nCounter;
LeaveCriticalSection(&cs);
@@ -192,9 +191,9 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec0
}
// Construct starter's command line
- _stprintf(eventBreakName, _T("SABreak%p"), pCurProcInfo);
- _stprintf(eventWaitName, _T("SAWait%p"), pCurProcInfo);
- _stprintf(eventTerminateName, _T("SATerm%p"), pCurProcInfo);
+ _stprintf(eventBreakName, L"SABreak%p", pCurProcInfo);
+ _stprintf(eventWaitName, L"SAWait%p", pCurProcInfo);
+ _stprintf(eventTerminateName, L"SATerm%p", pCurProcInfo);
pCurProcInfo -> eventBreak = CreateEventW(NULL, TRUE, FALSE, eventBreakName);
ResetEvent(pCurProcInfo -> eventBreak);
pCurProcInfo -> eventWait = CreateEventW(NULL, TRUE, FALSE, eventWaitName);
@@ -202,7 +201,7 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec0
pCurProcInfo -> eventTerminate = CreateEventW(NULL, TRUE, FALSE, eventTerminateName);
ResetEvent(pCurProcInfo -> eventTerminate);
- nPos = _stprintf(szCmdLine, _T("%sstarter.exe %i %i %s %s %s "), path, pid, nLocalCounter, eventBreakName, eventWaitName, eventTerminateName);
+ nPos = _stprintf(szCmdLine, L"%sstarter.exe %i %i %s %s %s ", path, pid, nLocalCounter, eventBreakName, eventWaitName, eventTerminateName);
// Prepare command line
for(i = 0; i < nCmdTokens; ++i)
@@ -263,7 +262,7 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec0
_stprintf(buffer, _T("%s\n"), str);
OutputDebugStringW(buffer);
#endif
- _tcsnccpy(szEnvBlock + nPos, str, len);
+ _tcsncpy(szEnvBlock + nPos, str, len);
nPos += len;
szEnvBlock[nPos] = _T('\0');
++nPos;
@@ -386,7 +385,7 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec0
file_handles[0] = (int)stdHandles[0];
file_handles[1] = (int)stdHandles[1];
file_handles[2] = (int)stdHandles[2];
- (*env) -> SetIntArrayRegion(env, channels, 0, 3, file_handles);
+ (*env) -> SetIntArrayRegion(env, channels, 0, 3, (jint *)file_handles);
#ifdef DEBUG_MONITOR
OutputDebugStringW(_T("Process started\n"));
#endif
@@ -484,7 +483,7 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec1
return 0;
}
}
- _tcsnccpy(szEnvBlock + nPos, str, len);
+ _tcsncpy(szEnvBlock + nPos, str, len);
nPos += len;
szEnvBlock[nPos] = _T('\0');
++nPos;
diff --git a/core/org.eclipse.cdt.core.win32/library/iostream.c b/core/org.eclipse.cdt.core.win32/library/iostream.c
index 01bc078e3c..241e16bc75 100644
--- a/core/org.eclipse.cdt.core.win32/library/iostream.c
+++ b/core/org.eclipse.cdt.core.win32/library/iostream.c
@@ -79,8 +79,8 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_SpawnerInputStream_rea
while(len > nBuffOffset)
{
- int nNumberOfBytesToRead = min(len - nBuffOffset, BUFF_SIZE);
- int nNumberOfBytesRead;
+ DWORD nNumberOfBytesToRead = min(len - nBuffOffset, BUFF_SIZE);
+ DWORD nNumberOfBytesRead;
if(0 == ReadFile((HANDLE)fd, tmpBuf, nNumberOfBytesToRead, &nNumberOfBytesRead, &overlapped ))
{
int err = GetLastError();
@@ -182,8 +182,8 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_SpawnerOutputStream_wr
while(len > nBuffOffset)
{
- int nNumberOfBytesToWrite = min(len - nBuffOffset, BUFF_SIZE);
- int nNumberOfBytesWritten;
+ DWORD nNumberOfBytesToWrite = min(len - nBuffOffset, BUFF_SIZE);
+ DWORD nNumberOfBytesWritten;
(*env) -> GetByteArrayRegion(env, buf, nBuffOffset, nNumberOfBytesToWrite, tmpBuf);
if(0 == WriteFile((HANDLE)fd, tmpBuf, nNumberOfBytesToWrite, &nNumberOfBytesWritten, NULL))
{
diff --git a/core/org.eclipse.cdt.core.win32/library/spawner.c b/core/org.eclipse.cdt.core.win32/library/spawner.c
index 6ada9da075..d9b0f2748b 100644
--- a/core/org.eclipse.cdt.core.win32/library/spawner.c
+++ b/core/org.eclipse.cdt.core.win32/library/spawner.c
@@ -39,7 +39,7 @@ BOOL APIENTRY DllMain( HANDLE hModule,
if(NULL != p)
*(p + 1) = _T('\0');
else
- _tcscat(path, _T("\\"));
+ _tcscat(path, L"\\");
}
break;
case DLL_THREAD_ATTACH:

Back to the top