From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Building an encapsulated library that uses GNAT sockets under Windows
Date: Thu, 21 Apr 2016 14:59:35 +0200
Date: 2016-04-21T14:59:35+02:00 [thread overview]
Message-ID: <nfaisf$nu6$1@gioia.aioe.org> (raw)
It seems I finally found a way to build it. The solution is quite
perplexing. I would be glad if anybody could shed some light on it.
An encapsulated library requires that -lws2_32 -lwsock32 appeared *both*
at the beginning and the end of the linker command line. Only then no
"undefined reference" messages appear.
For this build this program:
--------------------------------------- gcc_wrapper.adb ---
with Ada.Command_Line; use Ada.Command_Line;
with Ada.Exceptions; use Ada.Exceptions;
with Ada.Text_IO; use Ada.Text_IO;
with GNAT.OS_Lib; use GNAT.OS_Lib;
procedure GCC_Wrapper is
Prefix : String_List :=
( new String'("-lwsock32"),
new String'("-lws2_32")
);
Options : String_List (1..Argument_Count);
begin
for No in 1..Argument_Count loop
Options (No) := new String'(Argument (No));
end loop;
declare
List : String_List := Prefix & Options & Prefix;
begin
Put ("gcc.exe");
for No in List'Range loop
Put (" " & List (No).all);
end loop;
New_Line;
Set_Exit_Status (Exit_Status (Spawn ("gcc.exe", List)));
end;
exception
when Error : others =>
Put_Line
( Standard_Error,
"Fault: " & Exception_Information (Error)
);
Set_Exit_Status (2);
end GCC_Wrapper;
--------------------------------------- gcc_wrapper.adb ---
The project file must contain:
package Linker is
for Driver use "<absolute-path-to>/gcc_wrapper.exe";
end Linker;
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
next reply other threads:[~2016-04-21 12:59 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-21 12:59 Dmitry A. Kazakov [this message]
2016-04-22 7:58 ` Building an encapsulated library that uses GNAT sockets under Windows ahlan.marriott
2016-04-22 8:23 ` Dmitry A. Kazakov
2016-04-23 9:20 ` Ahlan
2016-04-23 9:48 ` Dmitry A. Kazakov
2016-04-23 14:45 ` ahlan.marriott
2016-04-23 19:56 ` Dmitry A. Kazakov
2016-04-23 21:16 ` Simon Wright
2016-04-24 8:13 ` ahlan
2016-04-24 8:31 ` Simon Wright
2016-04-26 19:43 ` ahlan.marriott
2016-04-26 20:24 ` Simon Wright
2016-04-26 22:32 ` Jeffrey R. Carter
2016-04-27 22:16 ` Randy Brukardt
2016-04-27 23:43 ` Jeffrey R. Carter
2016-04-28 5:18 ` J-P. Rosen
2016-04-28 5:59 ` Jeffrey R. Carter
2016-05-09 22:32 ` David Thompson
2016-04-28 20:23 ` Randy Brukardt
2016-04-28 21:47 ` Jeffrey R. Carter
2016-04-28 5:13 ` J-P. Rosen
2016-04-26 20:20 ` Dmitry A. Kazakov
2016-04-26 21:23 ` Simon Wright
2016-04-27 6:53 ` Simon Wright
2016-04-27 7:25 ` ahlan
2016-04-27 8:27 ` Dmitry A. Kazakov
2016-04-27 9:59 ` Simon Wright
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox