comp.lang.ada
 help / color / mirror / Atom feed
* linking problem when using sockets with gnat 3.10p1 for NT
@ 1998-07-22  0:00 Frans Bouwmans
  1998-07-23  0:00 ` Tom Griest
  1998-07-23  0:00 ` Jerry van Dijk
  0 siblings, 2 replies; 4+ messages in thread
From: Frans Bouwmans @ 1998-07-22  0:00 UTC (permalink / raw)


I'm trying to use sockets in ada with gnat 3.10
I used glade as an example for calling to windows socket calls
however I get problems with linking
This is a part of the code showing the problem

--
with interfaces.c;
pragma Linker_Options ("-lwsock32");


procedure test_sock is
   package c renames interfaces.c;

   package net is
      function C_Listen (S, Backlog : C.int) return C.int;

   private
      pragma Import (C, C_Listen, "listen");
   end net;

  s,backlog,result : C.int;
begin
  result := net.C_Listen(s,backlog);
end test_sock;


-- this program compiles correctly but does not link it gives the following
error:

gnatlink test_sock.ali -lwsock32

./test_sock.o: In function `ada_test_sock':
//C/USR/ada/l11/test_sock.adb:17: undefined reference to `listen'

the linker can find the libwsock32.a because when i change the name it
cannot find it

Frans






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

* Re: linking problem when using sockets with gnat 3.10p1 for NT
  1998-07-22  0:00 linking problem when using sockets with gnat 3.10p1 for NT Frans Bouwmans
@ 1998-07-23  0:00 ` Tom Griest
  1998-07-28  0:00   ` Frans Bouwmans
  1998-07-23  0:00 ` Jerry van Dijk
  1 sibling, 1 reply; 4+ messages in thread
From: Tom Griest @ 1998-07-23  0:00 UTC (permalink / raw)


Frans Bouwmans <fbouwmans@spiditel.nl> wrote in article <6p5k11$iof$1@cadmium.aware.nl>...
> I'm trying to use sockets in ada with gnat 3.10

[lots-o-snips]

>       function C_Listen (S, Backlog : C.int) return C.int;
> 
>       pragma Import (C, C_Listen, "listen");

WinSock is a WinAPI (as opposed to a "C" library) which means
that it uses the "Stdcall" interface rather than "C".

Try:   pragma Import (Stdcall, C_Listen, "listen");


-Tom Griest





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

* Re: linking problem when using sockets with gnat 3.10p1 for NT
  1998-07-22  0:00 linking problem when using sockets with gnat 3.10p1 for NT Frans Bouwmans
  1998-07-23  0:00 ` Tom Griest
@ 1998-07-23  0:00 ` Jerry van Dijk
  1 sibling, 0 replies; 4+ messages in thread
From: Jerry van Dijk @ 1998-07-23  0:00 UTC (permalink / raw)


Frans Bouwmans (fbouwmans@spiditel.nl) wrote:

: I'm trying to use sockets in ada with gnat 3.10

: gnatlink test_sock.ali -lwsock32

I think you are using the NT compiler. If you go to my homepage
(http://stad.dsl.nl/~jvandyk) you can find a Win32 port of the
AdaSockets package. That should get you started.

Jerry.

-- 
-- Jerry van Dijk  | email: jdijk@acm.org
-- Leiden, Holland | member Team-Ada
-- Ada & Win32: http://stad.dsl.nl/~jvandyk




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

* Re: linking problem when using sockets with gnat 3.10p1 for NT
  1998-07-23  0:00 ` Tom Griest
@ 1998-07-28  0:00   ` Frans Bouwmans
  0 siblings, 0 replies; 4+ messages in thread
From: Frans Bouwmans @ 1998-07-28  0:00 UTC (permalink / raw)



Tom Griest heeft geschreven in bericht
<01bdb5d6$db0ad170$50c809c0@Saturn>...
>Frans Bouwmans <fbouwmans@spiditel.nl> wrote in article
<6p5k11$iof$1@cadmium.aware.nl>...
>> I'm trying to use sockets in ada with gnat 3.10
>
>[lots-o-snips]
>
This indeed solved the linking problem, later I found that I also have to
call "WSAstartup" before
a connection can be made. Unfortunately my code which was originally for
sparc used representation
clause to specify the layout of records to be sent over the socket. It took
a day to find the actual
translation from big endian to little endian so the rep clauses match. But I
got it working.

Unfortunately I started of with the socket programming before I read the
reply of Jerry van Dijk, so
I wrote my own socket server generic

Thanks for the prompt replies

Frans Bouwmans






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

end of thread, other threads:[~1998-07-28  0:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-07-22  0:00 linking problem when using sockets with gnat 3.10p1 for NT Frans Bouwmans
1998-07-23  0:00 ` Tom Griest
1998-07-28  0:00   ` Frans Bouwmans
1998-07-23  0:00 ` Jerry van Dijk

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