Question about having msvcrt*.dll and cygwin1.dll in one process

cyg Simple cygsimple@gmail.com
Mon Nov 17 14:09:00 GMT 2014


On Mon, Nov 17, 2014 at 4:48 AM, Jan Nijtmanswrote:
> 2014-11-17 9:47 GMT+01:00 Jing Zhao :
>> The outputs:
>> welcome to linux world
>> res: 7777777
>> it's over
>>
>> So everything look fine. According to the FAQ 6.15, is there anything
>> that's potentially dangerous that I should be aware of, when linking both
>> msvcrt.dll and cygwin1.dll? Thanks a lot!
>
> If it works, then you are simply lucky. Some pitfalls I know off:
>

Certainly lucky and usually won't work on all systems or even the same
system consistently.

> - when using stdin/stdout/stderr, msvcrt and cygwin1.dll have
>   their own implementation, which might conflict: locking over
>   multiple threads works differently, buffering is different. So
>   if both your application and the dll write to stdout, the
>   order in which both outputs are intermixed is not guaranteed.
> - exception handling is different. Don't expect an exception being
>   thrown in the dll to be handled gracefully in the application.
> - threading functions are different, same story.
> - dll initialization is different (recently a bug was fixed
>   regarding this, in a pre-fix version of cygwin1.dll your
>   current example might simply crash)
>

Memory control is the biggest issue.  Two different runtimes
controlling the same memory segments will not work!

-- 
cyg Simple

--
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



More information about the Cygwin mailing list