Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Ada > Re: Shared libr...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 7 of 9 Topic 5660 of 5800
Post > Topic >>

Re: Shared library in Ada

by Sebastien <seb.morand@[EMAIL PROTECTED] > Apr 19, 2008 at 02:47 PM

> Yes I'm running Gnat on FreeBSD.
> Thanks about this link, I didn't know.

I follow the instruction and did the sample thing:

Lib:
::::::::::::::
lib/mylib.adb
::::::::::::::
with Ada.Text_IO; use Ada.Text_IO;

package body MyLib is
         procedure Print is
         begin
                 Put_Line("The lib");
         end Print;
end MyLib;
::::::::::::::
lib/mylib.ads
::::::::::::::
package MyLib is

         procedure Print;
         pragma Ex****t (Convention => C, Entity => Print, External_Name 
=> "Print");
end MyLib;

::::::::::::::
main.adb
::::::::::::::
with MyLib; use MyLib;

procedure Main is
begin
         Print;
end Main;
::::::::::::::
mylib.ads
::::::::::::::
package MyLib is

         procedure Print;
         pragma Im****t (Convention => C, Entity => Print, External_Name 
=> "Print");
end MyLib;
::::::::::::::
main.gpr
::::::::::::::
Project Main is
         for Externally_Built use "true";
         for Source_Files use ("main.adb");
         pragma Linker_Options ("-lmylib");
end Main;

I compile the lib using:
gcc-4.1 -g3 -c mylib.adb
and link:
gcc-4.1 -shared -g3 -o ../libmylib.so mylib.o
I compile the main program using
gcc-4.1 -g3 -c mylib.ads
gcc-4.1 -g3 -c mylib.adb
and link:
gnatbind -x main.ali
gnatlink main.ali -lmylib

I got the following error:
# ./main

raised ADA.IO_EXCEPTIONS.STATUS_ERROR : s-fileio.adb:187

If I don't use shared object I got the program working, what am I missing?

Sebastien
 




 9 Posts in Topic:
Shared library in Ada
Sebastien <seb.morand@  2008-04-19 13:27:24 
Re: Shared library in Ada
Georg Bauhaus <rm.tsoh  2008-04-19 13:41:14 
Re: Shared library in Ada
Sebastien <seb.morand@  2008-04-19 13:51:31 
Re: Shared library in Ada
Robert A Duff <bobduff  2008-04-19 11:31:17 
Re: Shared library in Ada
Ludovic Brenta <ludovi  2008-04-19 13:52:32 
Re: Shared library in Ada
Sebastien <seb.morand@  2008-04-19 13:55:16 
Re: Shared library in Ada
Sebastien <seb.morand@  2008-04-19 14:47:43 
Re: Shared library in Ada
Ludovic Brenta <ludovi  2008-04-19 15:39:38 
Re: Shared library in Ada
=?ISO-8859-1?Q?S=E9bastie  2008-04-21 10:09:19 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sun Jul 6 19:41:48 CDT 2008.