Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Message-ID: <16379.59867.150000.61566@gargle.gargle.HOWL> Date: Wed, 7 Jan 2004 12:13:30 +0100 To: cygwin AT cygwin DOT com Subject: Windows shared libraries limitation From: Pascal Obry Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id i07BEJZq028502 Here is the problem. The auto-import feature for non scalar syms works only if the syms are the DATA section. So for constant arrays this not working. The following simple example will not work properly: clib.c: const char arr[] = "azertyazertyazertyazertyazertyazertyazertyazertyazerty"; $ gcc -shared -o clib.dll clib.c main.c: #include extern const char arr[]; int main (void) { int k; for (k=0; k<6; k++) printf ("arr[%d]=%c\n", k, arr[k]); } $ gcc -o main main.c clib.dll $ ./main arr[0]=ÿ arr[1]=% arr[2]=à arr[3]=` arr[4]=@ arr[5]= Of course the obvious fix is to remove the "const" attribute. But this is not a general solution. The problem occurs, for example, in the standard Ada libraries where it is not an option to change a constant to a variable (the spec are part of the standard). Is there a solution with the current GCC ? If not a solution would be to add an option to GCC for force all such syms into the DATA section. Thoughts ? Let me know if there is a more appropriate mailing-list to discuss this issue. Thanks, Pascal. -- --|------------------------------------------------------ --| Pascal Obry Team-Ada Member --| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE --|------------------------------------------------------ --| http://perso.wanadoo.fr/pascal.obry --| "The best way to travel is by means of imagination" --| --| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595 -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/