[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: 3.0.1 release? (Reports on mingw build)
From: |
Tatsuro MATSUOKA |
Subject: |
Re: 3.0.1 release? (Reports on mingw build) |
Date: |
Thu, 3 Apr 2008 14:08:05 +0900 (JST) |
Hello
--- "John W. Eaton" <address@hidden> wrote:
> On 3-Apr-2008, Tatsuro MATSUOKA wrote:
>
> | This time I'll report on mingw build.
> |
> | 1. The C++ source in liboctave, lo-sysdep.cc should be patched for win32
> native octave
> | (For cygwin it is not required.)
> |
> |
> | *** lo-sysdep.org.cc Thu Apr 3 03:43:36 2008
> | --- lo-sysdep.cc Thu Apr 3 08:55:24 2008
> | ***************
> | *** 39,44 ****
> | --- 39,48 ----
> | #include <fcntl.h>
> | #endif
> |
> | + #if defined (__WIN32__) && ! defined (__CYGWIN__)
> | + #include <windows.h>
> | + #endif
> | +
> | #include "file-ops.h"
> | #include "lo-error.h"
> | #include "pathlen.h"
>
> What problem does this solve?
>
> jwe
>
It is required to see the source:
The below uses the Win32 API so that it was impossible to be complied without
windows.h included
*********************************
#if defined (__WIN32__) && ! defined (__CYGWIN__)
pid_t
octave_popen2 (const std::string& cmd, const string_vector& args, bool
sync_mode,
int *fildes, std::string& msg)
{
pid_t pid;
PROCESS_INFORMATION pi;
STARTUPINFO si;
std::string command = "\"" + cmd + "\"";
HANDLE hProcess = GetCurrentProcess(), childRead, childWrite, parentRead,
parentWrite;
DWORD pipeMode;
ZeroMemory (&pi, sizeof (pi));
ZeroMemory (&si, sizeof (si));
si.cb = sizeof (si);
if (! CreatePipe (&childRead, &parentWrite, 0, 0) ||
! DuplicateHandle (hProcess, childRead, hProcess, &childRead, 0, TRUE,
DUPLICATE_SAME_ACCESS |
DUPLICATE_CLOSE_SOURCE))
{
msg = "popen2: pipe creation failed";
return -1;
}
if (! CreatePipe (&parentRead, &childWrite, 0, 0) ||
! DuplicateHandle (hProcess, childWrite, hProcess, &childWrite, 0, TRUE,
DUPLICATE_SAME_ACCESS |
DUPLICATE_CLOSE_SOURCE))
{
msg = "popen2: pipe creation failed";
return -1;
}
if (! sync_mode)
{
pipeMode = PIPE_NOWAIT;
SetNamedPipeHandleState (parentRead, &pipeMode, 0, 0);
SetNamedPipeHandleState (parentWrite, &pipeMode, 0, 0);
}
fildes[1] = _open_osfhandle (reinterpret_cast<long> (parentRead), _O_RDONLY |
_O_BINARY);
fildes[0] = _open_osfhandle (reinterpret_cast<long> (parentWrite), _O_WRONLY
| _O_BINARY);
si.dwFlags |= STARTF_USESTDHANDLES;
si.hStdInput = childRead;
si.hStdOutput = childWrite;
// Ignore first arg as it is the command
for (int k=1; k<args.length(); k++)
command += " \"" + args[k] + "\"";
OCTAVE_LOCAL_BUFFER (char, c_command, command.length () + 1);
strcpy (c_command, command.c_str ());
if (! CreateProcess (0, c_command, 0, 0, TRUE, 0, 0, 0, &si, &pi))
{
msg = "popen2: process creation failed";
return -1;
}
pid = pi.dwProcessId;
CloseHandle (childRead);
CloseHandle (childWrite);
CloseHandle (pi.hProcess);
CloseHandle (pi.hThread);
return pid;
}
#endif
******************************************************************
Oh! I found the below just after that.
The next '#include <windows.h>' is to be deleted.
Perhaps Michael implemeted those, please ask him for details.
However the current source for win32 is not correct.
#if defined (_MSC_VER) && ! defined (HAVE_DIRENT_H)
// FIXME -- it would probably be better to adapt the versions of
// opendir, readdir, and closedir from Emacs as they appear to be more
// complete implementations (do the functions below work for network
// paths, for example)? We can probably get along without rewinddir.
#include <windows.h>
Regards
Tatsuro
--------------------------------------
GANBARE! NIPPON! Win your ticket to Olympic Games 2008.
http://pr.mail.yahoo.co.jp/ganbare-nippon/
Re: 3.0.1 release? (Reports on mingw build), Tatsuro MATSUOKA, 2008/04/03
- Re: 3.0.1 release? (Reports on mingw build), John W. Eaton, 2008/04/03
- Re: 3.0.1 release? (Reports on mingw build),
Tatsuro MATSUOKA <=
- Re: 3.0.1 release? (Reports on mingw build), John W. Eaton, 2008/04/03
- Re: 3.0.1 release? (Reports on mingw build), Michael Goffioul, 2008/04/07
- Re: 3.0.1 release? (Reports on mingw build), Tatsuro MATSUOKA, 2008/04/07
- Re: 3.0.1 release? (Reports on mingw build), Michael Goffioul, 2008/04/07
- Re: 3.0.1 release? (Reports on mingw build), Tatsuro MATSUOKA, 2008/04/07
Re: 3.0.1 release? (Reports on mingw build), Tatsuro MATSUOKA, 2008/04/07
Re: 3.0.1 release?, Ben Abbott, 2008/04/02