linking problem when using sockets with gnat 3.10p1 for NT 
Author Message
 linking problem when using sockets with gnat 3.10p1 for NT

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



Sun, 07 Jan 2001 03:00:00 GMT  
 linking problem when using sockets with gnat 3.10p1 for NT

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

[lots-o-snips]

Quote:
>       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



Mon, 08 Jan 2001 03:00:00 GMT  
 linking problem when using sockets with gnat 3.10p1 for NT

: 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.

--

-- Leiden, Holland | member Team-Ada
-- Ada & Win32: http://stad.dsl.nl/~jvandyk



Mon, 08 Jan 2001 03:00:00 GMT  
 linking problem when using sockets with gnat 3.10p1 for NT

Tom Griest heeft geschreven in bericht


Quote:
>> 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



Sat, 13 Jan 2001 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. GNAT for NT Linking Problem

2. Which Win32Ada to use with GNAT 3.10p1?

3. Problem using DLLTOOL that comes with GNAT 3.10p for Windows NT

4. GNAT/NT 1.83 now available (was GNAT for Windows NT)

5. Q: link 3rd party library with GNAT on NT

6. LINK Undefined Reference to WIN32 binding using GNAT 3.13

7. Dynamic linking using Gnat Ada

8. GNAT.Sockets Problems

9. Bug in GNAT.Socket.Check_Selector in GNAT 3.14 Linux runtime

10. Using COBOL, Windows NT, and Sockets

11. anyone using sockets, NT and (new) threads successfully?

12. ALERT: possible infinite loop using Tcl sockets on Windows 95, NT

 

 
Powered by phpBB® Forum Software