From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out-no.shaw.ca (smtp-out-no.shaw.ca [64.59.134.13]) by sourceware.org (Postfix) with ESMTPS id EC7EC3851C06 for ; Tue, 30 Jun 2020 14:45:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org EC7EC3851C06 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=SystematicSw.ab.ca Authentication-Results: sourceware.org; spf=none smtp.mailfrom=brian.inglis@systematicsw.ab.ca Received: from [192.168.1.104] ([24.64.172.44]) by shaw.ca with ESMTP id qHVjjYa8w62brqHVkjNOrs; Tue, 30 Jun 2020 08:45:25 -0600 X-Authority-Analysis: v=2.3 cv=LKf9vKe9 c=1 sm=1 tr=0 a=kiZT5GMN3KAWqtYcXc+/4Q==:117 a=kiZT5GMN3KAWqtYcXc+/4Q==:17 a=IkcTkHD0fZMA:10 a=w_pzkKWiAAAA:8 a=oSuH_FOv-Y10M8My5SwA:9 a=QEXdDO2ut3YA:10 a=9c8rtzwoRDUA:10 a=sRI3_1zDfAgwuvI8zelB:22 Reply-To: cygwin@cygwin.com Subject: Re: Using cygwin-dll with msvc-exe To: cygwin@cygwin.com References: <00a401d64b9c$9958e6d0$cc0ab470$@gmail.com> <56b93fc2-1a64-4d53-5ce5-5038b263d251@SystematicSw.ab.ca> <000801d64eae$3ed3eb00$bc7bc100$@gmail.com> From: Brian Inglis Autocrypt: addr=Brian.Inglis@SystematicSw.ab.ca; prefer-encrypt=mutual; keydata= mDMEXopx8xYJKwYBBAHaRw8BAQdAnCK0qv/xwUCCZQoA9BHRYpstERrspfT0NkUWQVuoePa0 LkJyaWFuIEluZ2xpcyA8QnJpYW4uSW5nbGlzQFN5c3RlbWF0aWNTdy5hYi5jYT6IlgQTFggA PhYhBMM5/lbU970GBS2bZB62lxu92I8YBQJeinHzAhsDBQkJZgGABQsJCAcCBhUKCQgLAgQW AgMBAh4BAheAAAoJEB62lxu92I8Y0ioBAI8xrggNxziAVmr+Xm6nnyjoujMqWcq3oEhlYGAO WacZAQDFtdDx2koSVSoOmfaOyRTbIWSf9/Cjai29060fsmdsDLg4BF6KcfMSCisGAQQBl1UB BQEBB0Awv8kHI2PaEgViDqzbnoe8B9KMHoBZLS92HdC7ZPh8HQMBCAeIfgQYFggAJhYhBMM5 /lbU970GBS2bZB62lxu92I8YBQJeinHzAhsMBQkJZgGAAAoJEB62lxu92I8YZwUBAJw/74rF IyaSsGI7ewCdCy88Lce/kdwX7zGwid+f8NZ3AQC/ezTFFi5obXnyMxZJN464nPXiggtT9gN5 RSyTY8X+AQ== Organization: Systematic Software Message-ID: Date: Tue, 30 Jun 2020 08:45:23 -0600 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 MIME-Version: 1.0 In-Reply-To: <000801d64eae$3ed3eb00$bc7bc100$@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-CA Content-Transfer-Encoding: 7bit X-CMAE-Envelope: MS4wfDeRjVVpXSCVP6YvNYOYg9Ujm/SL4U5vvesIpFlrNFVz4VI0tvif2vo184RHRqkAN3VWk1bdYw/I0xTmgReTn+jNSND7R25z81Oo04HfpZtOCwqMcrfU u79SzlVQCXC0ezCZXu/4joppDmOojm8z8JlyaY/URBPbOOx0ZqU9fd2zJm14G4/t5yQrecwe1uR6RA== X-Spam-Status: No, score=-10.0 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: cygwin@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Jun 2020 14:45:27 -0000 On 2020-06-30 01:15, Kristian Ivarsson via Cygwin wrote: > [snip] > >> They have incompatible internal startup and runtime environments including >> stuff like initialization, signal, and exit function handling >> (cygwin/newlib/gcc vs >> Windows/APIs/VC) although Cygwin can build Windows-loadable dlls and >> Windows-runnable exes and call Windows (system) dlls that don't depend on >> msvcrt. > What is interesting is that ldd on cygwin1.dll says it depends on > msvcrt.dll, but that might not be a problem ? That might not be accurate: $ cygcheck cygwin1.dll Found: C:\...\cygwin64\bin\cygwin1.dll C:\...\cygwin64\bin\cygwin1.dll C:\Windows\system32\KERNEL32.dll C:\Windows\system32\ntdll.dll C:\Windows\system32\KERNELBASE.dll > It seems like you could somehow fix it with this trick > https://cygwin.com/faq/faq.html#faq.programming.msvs-mingw (though I don't > really understand what difference it would make, because something seems to > be missing in the explanation (or more probably there's something I don't > understand;-) and it seems to be a bit cumbersome as well if you're having a > large product with a long lifetime) That says you could build Cygwin apps using MS VC/VS, but must first build all libraries you use, including cygwin, as MS VC/VS compatible DLLs using gcc, impdef, and lib, and call their routines via Windows APIs, as they duplicate msvcrt routines. Both cygdrop and cygrunsrv do something similar: $ cygcheck cygdrop Found: C:\...\cygwin64\bin\cygdrop.exe C:\...\cygwin64\bin\cygdrop.exe C:\...\cygwin64\bin\cygwin1.dll C:\Windows\system32\KERNEL32.dll C:\Windows\system32\ntdll.dll C:\Windows\system32\KERNELBASE.dll C:\Windows\system32\ADVAPI32.dll C:\Windows\system32\msvcrt.dll C:\Windows\system32\SECHOST.dll C:\Windows\system32\RPCRT4.dll $ cygcheck cygrunsrv Found: C:\...\cygwin64\bin\cygrunsrv.exe C:\...\cygwin64\bin\cygrunsrv.exe C:\...\cygwin64\bin\cygwin1.dll C:\Windows\system32\KERNEL32.dll C:\Windows\system32\ntdll.dll C:\Windows\system32\KERNELBASE.dll C:\Windows\system32\ADVAPI32.dll C:\Windows\system32\msvcrt.dll C:\Windows\system32\SECHOST.dll C:\Windows\system32\RPCRT4.dll C:\Windows\system32\USER32.dll C:\Windows\system32\win32u.dll C:\Windows\system32\GDI32.dll Msys/2/Mingw allow Windows apps to be built by them or their Mingw Cygwin packages, to run natively/standalone under Windows, so they can be used when building, installing, or maintaining Cygwin, including e.g. cygcheck and setup: $ cygcheck cygcheck Found: C:\...\cygwin64\bin\cygcheck.exe C:\...\cygwin64\bin\cygcheck.exe C:\Windows\system32\ADVAPI32.dll C:\Windows\system32\msvcrt.dll C:\Windows\system32\ntdll.dll C:\Windows\system32\KERNELBASE.dll C:\Windows\system32\SECHOST.dll C:\Windows\system32\RPCRT4.dll C:\Windows\system32\KERNEL32.dll C:\Windows\system32\PSAPI.DLL C:\Windows\system32\USER32.dll C:\Windows\system32\win32u.dll C:\Windows\system32\GDI32.dll C:\Windows\system32\WININET.dll $ cygcheck setup-x86_64 Found: C:\...\setup-x86_64.exe C:\...\setup-x86_64.exe C:\Windows\system32\ADVAPI32.dll C:\Windows\system32\msvcrt.dll C:\Windows\system32\ntdll.dll C:\Windows\system32\KERNELBASE.dll C:\Windows\system32\SECHOST.dll C:\Windows\system32\RPCRT4.dll C:\Windows\system32\KERNEL32.dll C:\Windows\system32\COMCTL32.dll C:\Windows\system32\GDI32.dll C:\Windows\system32\win32u.dll C:\Windows\system32\USER32.dll C:\Windows\system32\ole32.dll C:\Windows\system32\combase.dll C:\Windows\system32\bcryptPrimitives.dll C:\Windows\system32\PSAPI.DLL C:\Windows\system32\SHELL32.dll C:\Windows\system32\SHLWAPI.dll C:\Windows\system32\WININET.dll C:\Windows\system32\WS2_32.dll > In my honest opinion I think this disability to use cygwin-libraries from > windows-applications kind of limits some of cygwins purpose, but I do still > think cygwin is a great open source project ;-) You have a choice under Cygwin of: - using Cygwin POSIX libraries with the Cygwin Unix emulation interface, allowing you to build and run most packages that run under Unix, without system (e.g. BSD, Darwin/MacOSX, or Linux) dependencies, including Cygwin/X to build and run X Window packages, or else - using Mingw packages and utilities with the Windows APIs. -- Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada This email may be disturbing to some readers as it contains too much technical detail. Reader discretion is advised. [Data in IEC units and prefixes, physical quantities in SI.]