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.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,1a80a77402b27e77 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!feeder.news-service.com!news.motzarella.org!motzarella.org!not-for-mail From: Sebastien Newsgroups: comp.lang.ada Subject: Re: Shared library in Ada Date: Sat, 19 Apr 2008 13:51:31 +0200 Organization: A noiseless patient Spider Message-ID: References: <4809da5c$0$625$9b4e6d93@newsspool1.arcor-online.net> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: feeder.motzarella.org U2FsdGVkX19Zg438fhjjQA5uxh3q/UFzekLqAh6ao3VpAgTdxUDBuTBWzXT8OGfsgQ4qSi9xqjGVNuvBlyJQ2WeTWvhx5hJLZ6hZ+lQmzDLiT5x2FtjkJMycMD79+jzopb9MnFvBpNg= X-Complaints-To: Please send complaints to abuse@motzarella.org with full headers NNTP-Posting-Date: Sat, 19 Apr 2008 11:51:27 +0000 (UTC) In-Reply-To: <4809da5c$0$625$9b4e6d93@newsspool1.arcor-online.net> X-Auth-Sender: U2FsdGVkX1+dQGgMwuNtRSVPjuDlOInHEJQymMfxnnc= Cancel-Lock: sha1:DhsT1oJFSPe27K+AtJpqujrEzyA= User-Agent: Thunderbird 2.0.0.6 (Windows/20070728) Xref: g2news1.google.com comp.lang.ada:21000 Date: 2008-04-19T13:51:31+02:00 List-Id: > I suppose you are referring to dynamic linking at the OS level? Yes I am. > In this case you need to import functions from the library, perhaps > using pragma Import. Also, have a look at descriptions of the Ada > package hierarchy "Interfaces" But it's for interfacing with other languages, isn't it? The point is I don't want to interface with some other language, I want to create Shared object in Ada and then link with this shared object > The imported functions will have to match subprogram declarations > in your package mylibpkg. So you mean that if I use the pragma export in my ads file, everything is going to be fine? For instance: function My_Ada_Function return Integer is begin return 1; end My_Ada_Function; pragma Export (Convention => C, Entity => My_Ada_Function, External_Name => "My_Ada_Function" ); Or will I have to get two ads file? One with the pragma Export to create the shared object, and then one with the Pragma import to use the shared object in my program? > The documentation that came with your compiler should explain > the switches needed for linking with shared libraries. Yes I think I can find out by myself especially because I'm using gnat ;-) Sebastien