Bruno Haible wrote: > KO Myung-Hun: >>>> * lib/pipe-filter-ii.c (start_wrapper, _beginthreadex, CloseHandle, >>>> WaiForSingleObject, WaitForMultipleObjects): New on OS/2 kLIBC. >>> >>> Since you make use of these functions in w32spawn.h, their implementation >>> does not belong in pipe-filter-ii.c, but rather in some other .c file, >>> say w32-on-os2.c. >>> >> >> They are used only for pipe-filter-ii.c. w32spawn.h is used to use >> Windows codes of spawn-pipe module. >> >> Still should I generates separate files ? > > There are multiple reasons to put the implementation of these functions > in a file different from pipe-filter-ii.c: > - _beginthreadex is also used in pipe-filter-gi.c. > - WaitForSingleObject is also used in poll.c. > - These functions are implementations of Windows library API on top of > kLIBC API. Something different than just the implementation of > pipe_filter_ii_execute. >
But there are a few problems. First, those functions were tested only for pipe-filter-ii module. So It's not certain that they work for other modules, too. Second, those functions are not general version. They are specialized version to pipe-filter-ii module. So they cannot used for other purpose. For examples, HANDLE on Windows can hold various type objects. But HANDLE implementation here supports only a thread. Likewise for WaitForSingleObject(). Third, there is no need to use Windows codes in other modules, too. Because many non-Windows implementations may be used by kLIBC as well. It would be better to use codes selectively. > w32spawn.h is the layer that implements "auxiliary functions for the > creation of subprocesses", based on the Windows API. > Yes. But REAL Windows APIs seem not to be used. So it was possible not to include windows.h. > The functions here are an implementation of Windows API on top of kLIBC > API. Therefore it does not belong in w32spawn.h, No. It belongs to pipe-filter-ii.c. > but rather in a different file w32-on-os2.{h,c}. > As I said above, if including w32-on-os2.h in w32spawn.h and depending on w32-on-os2.c, then it can not be expected whether other modules will work or not. Here Windows APIs implementations are not related to w32spawn.h, they are only for pipe-ii-filter.c. Modification of w32spawn.h is needed to use codes for Windows of spawn-pipe.c. Strictly speaking, w32spawn.h and spawn-pipe.c are one patch set, and pipe-ii-filter.c is the other patch set based on it. -- KO Myung-Hun Using Mozilla SeaMonkey 2.7.2 Under OS/2 Warp 4 for Korean with FixPak #15 In VirtualBox v4.1.32 on Intel Core i7-3615QM 2.30GHz with 8GB RAM Korean OS/2 User Community : http://www.ecomstation.co.kr