delorie.com/archives/browse.cgi | search |
X-Recipient: | archive-cygwin AT delorie DOT com |
X-SWARE-Spam-Status: | No, hits=-0.2 required=5.0 tests=AWL,BAYES_05,T_RP_MATCHES_RCVD |
X-Spam-Check-By: | sourceware.org |
Message-ID: | <4DE5773D.9040008@tlinx.org> |
Date: | Tue, 31 May 2011 16:18:21 -0700 |
From: | Linda Walsh <cygwin AT tlinx DOT org> |
User-Agent: | Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1.24) Thunderbird/2.0.0.24 Mnenhy/0.7.6.666 |
MIME-Version: | 1.0 |
To: | cygwin AT cygwin DOT com |
Subject: | Why does windows have such probs with dynamically loaded libs? |
References: | <loom DOT 20110529T133128-564 AT post DOT gmane DOT org> <20110529233841 DOT GC5283 AT ednor DOT casa DOT cgf DOT cx> <loom DOT 20110530T093057-556 AT post DOT gmane DOT org> <20110530174649 DOT GB14225 AT ednor DOT casa DOT cgf DOT cx> |
In-Reply-To: | <20110530174649.GB14225@ednor.casa.cgf.cx> |
X-Stationery: | 0.5.1 |
X-IsSubscribed: | yes |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
List-Id: | <cygwin.cygwin.com> |
List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
List-Archive: | <http://sourceware.org/ml/cygwin/> |
List-Post: | <mailto:cygwin AT cygwin DOT com> |
List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
Sender: | cygwin-owner AT cygwin DOT com |
Mail-Followup-To: | cygwin AT cygwin DOT com |
Delivered-To: | mailing list cygwin AT cygwin DOT com |
Christopher Faylor wrote: > If you have an application which uses a lot of dlls then best practice > for Windows DLLs is to build them with unique load addresses. Barring > that you could rebase them with cygwin's rebase or rebaseall utilties. > Setting unique base addresses will actually cause your application to > load slightly faster whether you use Cygwin or not. ---- Other than the stock answer of poor design, it seems loading a dynamically linked library at run-time shouldn't be a difficult task. 1) find out # of 'segments' and size. 2) allocate space somewhere 'unused' in the address space. (malloc seems to usually work for this) 3) load contents 4) get the symbol(s) needed and add them to the loaded address, and pass that back to the dlopen call for patching it's call tables so future calls can call the libs directly. 5) enjoy. ... So why all these problems with conflicting load addresses? When Cygwin forks, how different is it from linux (other than stock answer of 'alot'), i.e. Does it create a new process and load the same static libs in, then have problems with dynamically loaded libs because they aren't recorded in the static binary? Does cygwin actually copy, or attempt to setup COW pages that are not from static libs? If so, wouldn't that catch dynamically loaded libs? This may be complete insanity, but given the low level of support of MS's own Unix subsystem, I wonder if they might be persuaded (if it was desired) to lend more help or hooks for cygwin to do its magic reliably. It seems like it would be a win for MS -- since many Windows users (not just 'end', but corporate as well) often make use of Cygwin -- you'd think MS might think kindly toward efforts to help Cygwin work well with current versions of windows...but then my name is given as an example in some political dictionaries as an example under 'naïve' ;-/... -- 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
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |