Hi, mingw and cygwin ld has a feature called auto-import, which allows to import data symbols without any dllexport/dlimport decoration. While this feature works for many cases importing const data with gcc >= 4 fails.
A description of the problem could be found here http://www.cygwin.com/ml/cygwin/2004-09/msg01101.html In http://cygwin.com/ml/cygwin/2007-07/msg00470.html there are two solutions described. As you can see from Chuck's message it's kind of a hairy situation in that there is no "real" fix for it other than undoing the optimization of placing these in a readonly section. That can be accomplished by either using a modified linker script or by removing the 'const' from the declaration. The former is a sort of brute force/last ditch approach which is useful if you have a very large code base with lots of modules and you can't or don't want to hunt down the offending structs. I think the qt project had to take this approach: <http://www.cygwin.com/ml/cygwin/2004-10/msg01052.html> Because this problem seems to hit many people the question is if this linker script could be integrated in ld and automatically used for linking in case auto-import is enabled. -- Summary: auto-import and const data import problem Product: binutils Version: unspecified Status: NEW Severity: normal Priority: P2 Component: ld AssignedTo: unassigned at sources dot redhat dot com ReportedBy: ralf dot habacker at freenet dot de CC: bug-binutils at gnu dot org,ralf dot habacker at freenet dot de http://sourceware.org/bugzilla/show_bug.cgi?id=4844 ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is. _______________________________________________ bug-binutils mailing list bug-binutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-binutils