This is the mail archive of the cygwin mailing list for the Cygwin project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Hello! > Okay, well I agree that this sounds like a good solution. For now you > have a workaround, and I'll be glad to consider a patch if you submit > one. Please take it. This is my experimental implementation which appears to be simpler than i suggested. Some details: this implementation adds explicit dllexport attribute to these 4 variables. This allows to look them up using GetProcAddress(). The dllexport attribute has to be added explicitly because when compiling an .exe file (without -shared switch) gcc does not mark externals as exportable by default. When building a .dll, all external symbols are marked as exportable by default, *UNLESS* we have at least one explicit dllexport specification, hence i surrounded this with #ifndef DLL_EXPORT, this definition is introduced by libtool when building a shared library. This implementation would not work in the following corner cases: a) .exe file uses some foo.dll library, which defines these variables and uses libargp - symbols are picked up only from .exe file itself. b) Building that foo.dll manually without DLL_EXPORT definition can get broken - the compiler will see dllexport attribute, and it will override the default behavior to make all externs exportable. I believe these cases are quite unusual so it's OK. Getting rid of these limitations would need more complex implementation with more changes. I have tested the implementation on x86-64 with RedHat's Prelink utility, and it works quite fine. i386 should work too, but please retest, just in case. Additionally, i added the second #ifdef _WIN32 in order to make the same thing working also for MinGW target. Kind regards, Pavel Fedin Expert Engineer Samsung Electronics Research center Russia
Attachment:
libargp-20110921-fix-optional-variables.diff
Description: Binary data
-- 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
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |