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.67.2.41 with SMTP id bl9mr13321800pad.9.1461311902877; Fri, 22 Apr 2016 00:58:22 -0700 (PDT) X-Received: by 10.182.117.40 with SMTP id kb8mr227771obb.7.1461311902778; Fri, 22 Apr 2016 00:58:22 -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!news.glorb.com!g8no5337321igr.0!news-out.google.com!uv8ni108igb.0!nntp.google.com!g8no5337320igr.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Fri, 22 Apr 2016 00:58:22 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=2a02:1205:c68c:9d90:f48c:e4b9:8a3:baa0; posting-account=Pm0FhgoAAAAiPscNT3etSZ15tHNZGXm_ NNTP-Posting-Host: 2a02:1205:c68c:9d90:f48c:e4b9:8a3:baa0 References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <58a4942a-452a-4f32-b39b-f8f1fdbfe9fb@googlegroups.com> Subject: Re: Building an encapsulated library that uses GNAT sockets under Windows From: ahlan.marriott@gmail.com Injection-Date: Fri, 22 Apr 2016 07:58:22 +0000 Content-Type: text/plain; charset=ISO-8859-1 Xref: news.eternal-september.org comp.lang.ada:30238 Date: 2016-04-22T00:58:22-07:00 List-Id: 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? Regards, Ahlan