This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: Want to build Win32 API code and Posix API code in Cygwin
- From: Qw Liu <liuqw093 at gmail dot com>
- To: cygwin at cygwin dot com, anrdaemon at yandex dot ru
- Date: Tue, 25 Feb 2014 10:09:38 +0800
- Subject: Re: Want to build Win32 API code and Posix API code in Cygwin
- Authentication-results: sourceware.org; auth=none
- References: <CA+-2duzzdkkYiXirqo=7FVOkXgDyyUXLy3+3NNmF6UND9aLMcg at mail dot gmail dot com> <304015319 dot 20140224135538 at yandex dot ru>
Hi Andrey,
Thanks for your patient answer. Actually the code is historic
legacy, and I want to have a quick try on Windows and reduce the
efforts as much as possible. Code part B mainly contains some device
operations, like serial port, ethernet config(not only socket), USB
detection, etc, code part A mainy contain process management and FS
operation, etc. I get "no tchar.h", "definition of gethostname
conflicts" like error when I build them together on Cygwin using GCC.
What is your advice under such situation? "Push all
platform-dependent code into a separate library" is another method I'm
trying for long-term resolution, but is there any approach I can have
a quick try w/o stbility and performance consideration?
Thanks a lot and appreciated for your reply!
2014-02-24 17:55 GMT+08:00 Andrey Repin <anrdaemon@yandex.ru>:
> Greetings, Qw Liu!
>
>> I have legacy code (part A) written in Posix API that I want to
>> port to Windows, and there is also some other necessary code (part B)
>> written in Win32 API, but seems that I cannot use GCC on Cygwin to
>> build them (A and B) together to get the executable program, since I
>> met issue like "header missing" for Win32 API .
>> Is there any other method to resolve such problem? I considerred
>> to build part B as dll first and build with part A on Cygwin. Is that
>> okay?
>
> My Crystal Ball is in service - overheated again...
> WHAT header you are missing, exactly?
> And before you answer that, you do aware, that mixing POSIX and Windows native
> API calls is generally considered not a very good idea, right?
> Depends on the kind of mix (stirred, not shaken?), you may be on a very sharp
> edge of things.
> Without looking at your code, one possible solution is to push all
> platform-dependent code into a separate library, and load it at runtime.
>
>
> --
> WBR,
> Andrey Repin (anrdaemon@yandex.ru) 24.02.2014, <13:49>
>
> Sorry for my terrible english...
>
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple