comp.lang.ada
 help / color / mirror / Atom feed
* Linking libraries from the command line using ObjectAda on Windows
@ 2003-06-24 16:17 Xavier SAUTEJEAU
  2003-06-24 17:34 ` Steve Hancher
  0 siblings, 1 reply; 3+ messages in thread
From: Xavier SAUTEJEAU @ 2003-06-24 16:17 UTC (permalink / raw)


Hi Everyone,

From the command line, I'd like to know how to build an exe that links with
a static library with ObjectAda.

Here is the library I want to build.

-- directory structure
    LibCall.adb -- file that calls the library
    Dummy.adb -- dummy file that Withs the library units
    + P_hello
       - P_hello.ads
       - P_hello.adb
    + P_hello_2
       - P_hello2.ads
       - P_hello2.adb

--P_hello2.ads
package P_hello2 is
 procedure hello;
end P_hello2;

--P_hello2.adb
With text_io;use text_io;
package body P_hello2 is
 procedure hello is
begin
  Put_Line("Hello library world 2");
 end hello;

end P_hello2;

--P_hello.ads
package P_hello is
 procedure hello;
end P_hello;

--P_hello.adb
With text_io;use text_io;
package body P_hello is
 procedure hello is
begin
  Put_Line("Hello library world");
 end hello;

end P_hello;

-- Dummy.adb
With P_Hello;
With P_Hello2;

procedure Dummy is
begin
 null;
end dummy;


To build the library I use the following commands

adareg P_hello\*.ad*
adareg P_hello_2\*.ad*
adareg dummy.adb
adamake
adabuild dummy
dir /s /b *.obj > list.txt
lib /out:hello.lib @list.txt
del /q list.txt ada.lib unit.map

Here is the exe I want to build that links with the library.

-- libcall.adb
With P_Hello;
With P_Hello2;
procedure libcall is
begin
 P_Hello.HELLO;
 P_Hello2.HELLO;
end Libcall;


To build the exe I use the following commands

REM registering library search path
adaopts -p.
adaopts -lp .
REM registering source files
adareg P_hello_2\*.ads
adareg P_hello\*.ads

adareg libcall.adb

adabuild libcall -ll hello

And I get the following output:
ObjectAda Special Edition Version 7.2.2: adabuild
    Copyright (c) 1997-2002 Aonix.  All rights reserved.
Front end of libcall.adb succeeded with no errors.
Front end of p_hello_2\p_hello2.ads succeeded with no errors.
Front end of p_hello\p_hello.ads succeeded with no errors.
libcall: Error: Source not found for P_hello2, NO_KIND.  Can't recompile.

libcall: Error: Source not found for P_hello, NO_KIND.  Can't recompile.

libcall: Error: Body not found for P_hello2

libcall: Error: Body not found for P_hello

libcall: Error: Link ended due to previous errors.


Where did I go wrong ?

Any help would be appreciated.





^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Linking libraries from the command line using ObjectAda on Windows
  2003-06-24 16:17 Linking libraries from the command line using ObjectAda on Windows Xavier SAUTEJEAU
@ 2003-06-24 17:34 ` Steve Hancher
  2003-06-30 16:13   ` Xavier SAUTEJEAU
  0 siblings, 1 reply; 3+ messages in thread
From: Steve Hancher @ 2003-06-24 17:34 UTC (permalink / raw)


Xavier SAUTEJEAU wrote:
> Hi Everyone,
> 
> From the command line, I'd like to know how to build an exe that links with
> a static library with ObjectAda.
> 
> Here is the library I want to build.
> 
> -- directory structure
>     LibCall.adb -- file that calls the library
>     Dummy.adb -- dummy file that Withs the library units
>     + P_hello
>        - P_hello.ads
>        - P_hello.adb
>     + P_hello_2
>        - P_hello2.ads
>        - P_hello2.adb
> 
> --P_hello2.ads
> package P_hello2 is
>  procedure hello;
> end P_hello2;
> 
> --P_hello2.adb
> With text_io;use text_io;
> package body P_hello2 is
>  procedure hello is
> begin
>   Put_Line("Hello library world 2");
>  end hello;
> 
> end P_hello2;
> 
> --P_hello.ads
> package P_hello is
>  procedure hello;
> end P_hello;
> 
> --P_hello.adb
> With text_io;use text_io;
> package body P_hello is
>  procedure hello is
> begin
>   Put_Line("Hello library world");
>  end hello;
> 
> end P_hello;
> 
> -- Dummy.adb
> With P_Hello;
> With P_Hello2;
> 
> procedure Dummy is
> begin
>  null;
> end dummy;
> 
> 
> To build the library I use the following commands
> 
> adareg P_hello\*.ad*
> adareg P_hello_2\*.ad*
> adareg dummy.adb
> adamake
> adabuild dummy
> dir /s /b *.obj > list.txt
> lib /out:hello.lib @list.txt
> del /q list.txt ada.lib unit.map
> 
> Here is the exe I want to build that links with the library.
> 
> -- libcall.adb
> With P_Hello;
> With P_Hello2;
> procedure libcall is
> begin
>  P_Hello.HELLO;
>  P_Hello2.HELLO;
> end Libcall;
> 
> 
> To build the exe I use the following commands
> 
> REM registering library search path
> adaopts -p.
> adaopts -lp .
> REM registering source files
> adareg P_hello_2\*.ads
> adareg P_hello\*.ads
> 
> adareg libcall.adb
> 
> adabuild libcall -ll hello
> 
> And I get the following output:
> ObjectAda Special Edition Version 7.2.2: adabuild
>     Copyright (c) 1997-2002 Aonix.  All rights reserved.
> Front end of libcall.adb succeeded with no errors.
> Front end of p_hello_2\p_hello2.ads succeeded with no errors.
> Front end of p_hello\p_hello.ads succeeded with no errors.
> libcall: Error: Source not found for P_hello2, NO_KIND.  Can't recompile.
> 
> libcall: Error: Source not found for P_hello, NO_KIND.  Can't recompile.
> 
> libcall: Error: Body not found for P_hello2
> 
> libcall: Error: Body not found for P_hello
> 
> libcall: Error: Link ended due to previous errors.
> 
> 
> Where did I go wrong ?
> 
> Any help would be appreciated.
> 
> 

You have a misunderstanding about the relationship between Ada libraries and
Windows libraries.  Creating a Windows library from Ada object files only
removes the requirement for the OBJ directory.  After creating the Windows
library, you should not delete either ADA.LIB or UNIT.MAP.  Then, libcall.adb
should be compiled into a different Ada library with a reference (via adaopts)
to the Ada library containing P_hello and P_hello2.  By the way, you don't
need to compile dummy.adb, you don't need to build dummy, and the adamake
won't work because you have never compiled anything.




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Linking libraries from the command line using ObjectAda on Windows
  2003-06-24 17:34 ` Steve Hancher
@ 2003-06-30 16:13   ` Xavier SAUTEJEAU
  0 siblings, 0 replies; 3+ messages in thread
From: Xavier SAUTEJEAU @ 2003-06-30 16:13 UTC (permalink / raw)


Thanks for the indication.

Now, I'd like to create an ADA library using ObjectAda and provide the user
only the specification files (.ADS) and an archive containing all the
required files but the implementation files (.ADB).

The idea being something like that: the user registers the spec files using
adareg and the -ll option to link to the archive.

All of it from the command line. This is like providing header files and
pre-compiled libraries in C.

I'd like an example of how to create such a library, and how to use it.

Does anyone know if I can and how to do that ?

Regards,

Xavier

"Steve Hancher" <shancher@sd.aonix.com> wrote in message
news:3EF88C70.8090405@sd.aonix.com...
> You have a misunderstanding about the relationship between Ada libraries
and
> Windows libraries.  Creating a Windows library from Ada object files only
> removes the requirement for the OBJ directory.  After creating the Windows
> library, you should not delete either ADA.LIB or UNIT.MAP.  Then,
libcall.adb
> should be compiled into a different Ada library with a reference (via
adaopts)
> to the Ada library containing P_hello and P_hello2.  By the way, you don't
> need to compile dummy.adb, you don't need to build dummy, and the adamake
> won't work because you have never compiled anything.
>





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-06-30 16:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-06-24 16:17 Linking libraries from the command line using ObjectAda on Windows Xavier SAUTEJEAU
2003-06-24 17:34 ` Steve Hancher
2003-06-30 16:13   ` Xavier SAUTEJEAU

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox