From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI autolearn=unavailable autolearn_force=no version=3.4.4 X-Google-Thread: 103376,344a642637dc2cf9,start X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!proxad.net!usenet-fr.net!enst.fr!melchior!cuivre.fr.eu.org!melchior.frmug.org!not-for-mail From: "Andrew Carroll" Newsgroups: comp.lang.ada Subject: Linking confusion Date: Fri, 3 Sep 2004 03:08:07 -0600 Organization: Cuivre, Argent, Or Message-ID: NNTP-Posting-Host: lovelace.ada-france.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Trace: melchior.cuivre.fr.eu.org 1094375062 16151 212.85.156.195 (5 Sep 2004 09:04:22 GMT) X-Complaints-To: usenet@melchior.cuivre.fr.eu.org NNTP-Posting-Date: Sun, 5 Sep 2004 09:04:22 +0000 (UTC) To: Return-Path: X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 X-Virus-Scanned: by amavisd-new-20030616-p7 (Debian) at rfc1149.net X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at ada-france.org X-BeenThere: comp.lang.ada@ada-france.org X-Mailman-Version: 2.1.4 Precedence: list List-Id: "Gateway to the comp.lang.ada Usenet newsgroup" List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Xref: g2news1.google.com comp.lang.ada:3330 Date: 2004-09-03T03:08:07-06:00 Okay, I recently downloaded AdaSDL sources for a project I am starting and tried to "make" the sources. (In case you are wondering, AdaBind has taken the back burner for now. Anyway...) There is a file that comes with the sources called compile.adb. Here is the whole file: pragma Warnings (off); with gl_h; with glu_h; with AdaGL; procedure compile is begin null; end compile; When I tried to make the AdaSDL sources (compile.adb) I stumbled onto a linking error that said it could not find the libraries specified with the "-l" option. It said it could not find one two of the libraries for GL and GLU. So, I edited the make.conf file so that it could find the appropriate libraries (GL and GLU libraries, which are actually Mesa libraries on FreeBSD). I then started the make process over again and came up with a second error. Here is the output: -bash-2.05b$ make make -C GL gnatmake -O3 -I../binding -I../GL -I/usr/X11R6/include/GL compile -largs -L/usr/lib -L/usr/local/lib -L~/lib -L/usr/X11R6/lib gnatbind -aO./ -aO../binding -aO../GL -aO/usr/X11R6/include/GL -I- -x compile.ali gnatlink -L/usr/lib -L/usr/local/lib -L~/lib -L/usr/X11R6/lib compile.ali /usr/local/lib/gcc-lib/i386-unknown-freebsd5.1/2.8.1/adalib//libgnat.so: warning: mktemp() possibly used unsafely; consider using mkstemp() ./adagl.o: In function `adagl__glgetstring': ./adagl.o(.text+0xb): undefined reference to `glGetString' ./adagl.o(.text+0x1a): undefined reference to `glGetString' gnatlink: cannot call /usr/local/bin/adagcc gnatmake: *** link failed. So I investigated a little further and now have some questions. The first question is related to gnatlink. If I specify "-L/usr/X11R6/lib" then it should search all the libraries in that directory for the library(s) that apply correct? In this case I think it is libGL.a or libGL.so (and libGLU.a or libGLU.so). Those libraries are in the /usr/X11R6/lib directory and "glGetString" implementation is provided in those libraries. gl_h.ads and glu_h.ads define the binding to GL for AdaGL and they use Interfaces.C. Now in order for gnatlink to find the "Interface implementations" that gl_h.ads and glu_h.ads define, the libraries for GL and GLU must be provided to gnatlink. Right? So, now, on to other questions. I pasted the contents of adagl.adb below. At first I thought that the glGetString in the AdaGL package below was the only glGetString. Then I looked in the gl_h.ads file and found a declaration for a second glGetString. Now even if the linking problem were fixed, wouldn't there be a compiler error as to which glGetString function to use in the Get_chars_ptr function? (because there is no package prefix on the function call). I thought Ada was not "context sensitive" as in return value making up part of function signature? Anyway, no biggie on the function signature question. Once I get it to link I'll be able to tell. package body AdaGL is package CS renames Interfaces.C.Strings; function To_chars_ptr is new Ada.Unchecked_Conversion ( GLubyte_Ptr, CS.chars_ptr); -- ====================================== function Get_chars_ptr (Chars_Ref : GLenum) return CS.chars_ptr is begin return To_chars_ptr (glGetString (Chars_Ref)); end Get_chars_ptr; -- ====================================== function glGetString (Chars_Ref : GLenum) return String is temp_chars_ptr : CS.chars_ptr; begin temp_chars_ptr := Get_chars_ptr (Chars_ref); if temp_chars_ptr /= Cs.Null_Ptr then return CS.Value (Get_chars_ptr (Chars_Ref)); else return ""; end if; end glGetString; -- ====================================== end AdaGL; P.S. I had to reinstall email client. How's the word wrap? Andrew Carroll Carroll-Tech 720-273-6814 andrew@carroll-tech.net