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=0.7 required=5.0 tests=BAYES_00,MSGID_RANDY autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,d0fcd3db00d6036 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-10-01 05:50:16 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news.uchicago.edu!newsswitch.lcs.mit.edu!snoopy.risq.qc.ca!wesley.videotron.net!news.cae.ca!not-for-mail From: "Bernard Azria" Newsgroups: comp.lang.ada Subject: Re: "extern" procedure in ada Date: Mon, 30 Sep 2002 18:39:12 -0400 Organization: CAE Message-ID: References: NNTP-Posting-Host: p3320.cae.ca X-Trace: dns3.cae.ca 1033425558 19831 142.39.94.189 (30 Sep 2002 22:39:18 GMT) X-Complaints-To: usenet@news.cae.ca NNTP-Posting-Date: 30 Sep 2002 22:39:18 GMT X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 Xref: archiver1.google.com comp.lang.ada:29440 Date: 2002-09-30T22:39:18+00:00 List-Id: Thanks to all for your quick responses, It helped me a lot. I decided to use a pragma import (ada, ..) and to ask people building the library to define in it, the coreponsding pragma export ( ada, .. ). In this way, I shouldn't have to "with " any file from the library. Thanks again, B.A. "Stephen Leake" wrote in message news:u7kh3o86d.fsf@gsfc.nasa.gov... > "Bernard Azria" writes: > > > I am looking for the equivallent of an "extern" definition procedure in > > C for ADA. > > > > In other words, how could I define an external procedure to my program > > without "withing" the package where it is defined ( I have only the "obj' > > and the "ali" file of this procedure in a library) > > I gather you are trying to use a library that you don't have source > for? Be careful not to violate your license to use the library. > > In order to call any subprogram from Ada, you need the specification of > the subprogram; the parameter types and return type. > > If you have the source code of the subprograms in Ada, you have the > subprogram specifications. > > If you don't have the source code (your case), you need to write the > specifications yourself, and tell the compiler to get the bodies of > the subprogram from the library. pragma Import is precisely what you > need to use for this task. > > For a library package, it is usually convenient to group the > specifications in an Ada package. The package spec contains all the > subprogram specs, and all the 'pragma Import' statements. > > If you are only calling a few subprograms from one place, putting the > subprogram specifications in the same package where you are calling > them makes sense. > > > Would it be an kind of : pragma import ( ADA, procedure_name ) > > Yes, exactly. Although, if the library .o is compiled by a different > compiler than your code, this is not guarranteed to work. You might > need your vendor to provide an "Ada_GNAT" convention. > > -- > -- Stephe