English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Language > Coders. C/C++

 
 
Thread Tools
Old 31 May 2024, 22:24   #1
copse
Registered User
 
Join Date: Jul 2009
Location: Lala Land
Posts: 604
Compiling against bsdsocket in C

I'm writing a socket server in C using vbcc (in WinUAE) and it doesn't link against the static libraries from AmiTCP. If I add the -vv option, I see the following:

Quote:
vlink -bamigahunk -t -x -Bstatic -Cvbcc -nostdlib -mrel vlibos3:startup.o "T:t_3_0.o" -Lnetlib -lnet -s -Rshort -Lvlibos3: -lvc -o a.out

Loading files:

vlibos3:startup.o (amigahunk object)
T:t_3_0.o (amigahunk object)
netlib/net.lib (amigahunk library)
Fatal error 13: netlib/net.lib: File format corrupted.
Aborting.
I have checked that the CRC of the file in the lha locally in 7zip is the same as the one on Aminet by browsing the archive contents online there.

There are two possible outcomes I suspect I am looking for:
  1. Someone points out the obvious thing I am doing wrong.
  2. I saw inline assembly in some of the C headers for bsdsocket calls. Perhaps someone knows how to use these and bypass the library calls?

Files used:
  1. https://aminet.net/package/dev/c/vbcc_bin_amigaos68k
  2. https://aminet.net/package/comm/tcp/AmiTCP-SDK-4.3
copse is offline  
Old 01 June 2024, 09:24   #2
thomas
Registered User
 
thomas's Avatar
 
Join Date: Jan 2002
Location: Germany
Posts: 7,026
I cannot help you with AmiTCP. But it is ancient. Try Roadshow SDK instead.

And what do you need static libs for? I never even bothered. But I am not a power user, I only ever wrote simple http clients.
thomas is offline  
Old 01 June 2024, 21:53   #3
copse
Registered User
 
Join Date: Jul 2009
Location: Lala Land
Posts: 604
I've not programmed in non-assembly on the Amiga before. What is the alternative to static libs? Inline header asm stubs?
copse is offline  
Old 01 June 2024, 23:21   #4
thomas
Registered User
 
thomas's Avatar
 
Join Date: Jan 2002
Location: Germany
Posts: 7,026
You are using vbcc. Just #include <proto/bsdsocket.h> and you are done. No need to link against any net lib.
thomas is offline  
Old 01 June 2024, 23:35   #5
copse
Registered User
 
Join Date: Jul 2009
Location: Lala Land
Posts: 604
Quote:
Originally Posted by thomas View Post
You are using vbcc. Just #include <proto/bsdsocket.h> and you are done. No need to link against any net lib.
Thanks. This fails due to a missing file 'clib/bsdsocket_protos.h' which is clearly another problem with the AmiTCP SDK. I'll get rid of it and replace it with Roadshow which you've kindly pointed me in the direction of.
copse is offline  
Old 01 June 2024, 23:53   #6
Hedeon
Semi-Retired
 
Join Date: Mar 2012
Location: Leiden / The Netherlands
Posts: 2,039
I think the posixlib for vbcc also has bsdsocket stuff?
Hedeon is offline  
Old 02 June 2024, 00:46   #7
copse
Registered User
 
Join Date: Jul 2009
Location: Lala Land
Posts: 604
That's a good tip Hedeon but it's unclear how useful this is. It refers to only opening bsdsocket.library when needed, but the perhaps unstated goal here is that the whole point is that bsdsocket.library is used. This is because WinUAE provides it and it allows a form of external communication.
copse is offline  
Old 09 June 2024, 13:20   #8
phx
Natteravn
 
phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,539
The network stuff is confusing with AmigaOS. Main problem here is: although AmiTCP and Roadshow both name their shared library
bsdsocket.library
the header files in their SDK are named differently. It is either
<proto/socket.h>
(from vbcc) and
<clib/socket_protos.h
(from AmiTCP SDK) or
<proto/bsdsocket.h>
(from vbcc) and
<clib/bsdsocket_protos.h>
(from Roadshow SDK).

So in this case (AmiTCP) including
<proto/socket.h>
might have helped.

As Thomas indicated, linking with any static libraries from the AmiTCP SDK is rarely required, if you include the proto header, because that automatically includes the inline-calls from
<inline/socket_protos.h>
.

The reason for the "corrupted file format" error is unclear. I couldn't reproduce it. But maybe the vlink used is just too old. The libraries in the AmiTCP-SDK are in SAS/C
HUNK_LIB
format, which vlink only supports since V15.

Also note that you have to be careful with the Include path from the AmiTCP-SDK. It overwrites compiler-specific standard headers like
stdio.h
and
errno.h
, which you must avoid. Solution for vbcc is to force reading from the standard include path before the AmiTCP-SDK include path. For example:
-Ivincludeos3: -IAmiTCP/netinclude


As far as I remember this situation improved with Roadshow.
phx is offline  
Old 09 June 2024, 21:56   #9
copse
Registered User
 
Join Date: Jul 2009
Location: Lala Land
Posts: 604
Thanks, it sounds like upgrading to the non-aminet version of vbcc/vlink is the way to go. I do have the amitcp headers last though, so that problem was avoided from the get go fortunately.
copse is offline  
Old 13 June 2024, 08:20   #10
bebbo
bye
 
Join Date: Jun 2016
Location: Some / Where
Posts: 681
Quote:
Originally Posted by phx View Post
The network stuff is confusing with AmigaOS. Main problem here is: although AmiTCP and Roadshow both name their shared library
bsdsocket.library
the header files in their SDK are named differently. It is either
<proto/socket.h>
(from vbcc) and
<clib/socket_protos.h
(from AmiTCP SDK) or
<proto/bsdsocket.h>
(from vbcc) and
<clib/bsdsocket_protos.h>
(from Roadshow SDK). So in this case (AmiTCP) including
<proto/socket.h>
might have helped.
...
proto/socket.h is also present in RoadShow and is the way to go.
bebbo is offline  
Old 13 June 2024, 10:54   #11
patrik
Registered User
 
patrik's Avatar
 
Join Date: Jan 2005
Location: UmeƄ
Age: 43
Posts: 934
Quote:
Originally Posted by phx View Post
As far as I remember this situation improved with Roadshow.
Yes and the Roadshow SDK works great even if you end up using AmiTCP or Miami as it is the same bsdsocket.library API. I only use the Roadshow SDK since a long time. I only use the proto files and do not link against any library.
patrik is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
bsdsocket enabled? davethemackem support.WinUAE 2 03 November 2022 14:29
BSDSocket SocketBaseTagList() flype support.WinUAE 10 05 October 2020 21:13
bsdsocket missing source support.WinUAE 3 23 June 2013 14:48
bsdsocket slowdown amigan support.WinUAE 0 20 January 2004 12:37
bsdsocket problem KurZon support.WinUAE 1 05 May 2003 10:42

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 22:50.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.08441 seconds with 15 queries