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=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.129.161.69 with SMTP id y66mr16946259ywg.44.1461403258291; Sat, 23 Apr 2016 02:20:58 -0700 (PDT) X-Received: by 10.182.3.239 with SMTP id f15mr219256obf.15.1461403258251; Sat, 23 Apr 2016 02:20:58 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!7no5391334qgj.0!news-out.google.com!uv8ni180igb.0!nntp.google.com!g8no5630186igr.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sat, 23 Apr 2016 02:20:57 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=2a02:1205:c68c:9d90:5427:cb02:649d:b73c; posting-account=Pm0FhgoAAAAiPscNT3etSZ15tHNZGXm_ NNTP-Posting-Host: 2a02:1205:c68c:9d90:5427:cb02:649d:b73c References: <58a4942a-452a-4f32-b39b-f8f1fdbfe9fb@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <68353b5d-94dc-4604-bdb1-00b48396ec1b@googlegroups.com> Subject: Re: Building an encapsulated library that uses GNAT sockets under Windows From: Ahlan Injection-Date: Sat, 23 Apr 2016 09:20:58 +0000 Content-Type: text/plain; charset=ISO-8859-1 Xref: news.eternal-september.org comp.lang.ada:30254 Date: 2016-04-23T02:20:57-07:00 List-Id: On Friday, 22 April 2016 10:23:31 UTC+2, Dmitry A. Kazakov wrote: > On 22/04/2016 09:58, ahlan@marriott.org wrote: > > On Thursday, 21 April 2016 15:00:04 UTC+2, Dmitry A. Kazakov wrote: > >> 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 "/gcc_wrapper.exe"; > >> end Linker; > >> > >> -- > >> Regards, > >> Dmitry A. Kazakov > >> http://www.dmitry-kazakov.de > > > > Dear Dmitry, > > > > Is this perhaps the solution to my question "Using Gnat.Sockets in a Windows DLL" that I posted on 8-Dec-2015? > > Yes, I think it is the same problem you reported. BTW, I built gprbuild > from the latest Git sources. That did not fix the problem. > > It looks really weird how GCC linker searches libraries under Windows. > Not to mention its abysmal performance. It takes literally an hour to > link an executable against 20-30 libraries. > > -- > Regards, > Dmitry A. Kazakov > http://www.dmitry-kazakov.de Dear Dmitry, The problem is not in Gprbuild.exe but in libexe/gprbuild/gprlib.exe Have you tried building Gprlib from the git sources? - that might be a more elegant solution. MfG Ahlan