31 May 2024, 22:24 | #1 | |
Registered User
Join Date: Jul 2009
Location: Lala Land
Posts: 608
|
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:
There are two possible outcomes I suspect I am looking for:
Files used: |
|
01 June 2024, 09:24 | #2 |
Registered User
Join Date: Jan 2002
Location: Germany
Posts: 7,053
|
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. |
01 June 2024, 21:53 | #3 |
Registered User
Join Date: Jul 2009
Location: Lala Land
Posts: 608
|
I've not programmed in non-assembly on the Amiga before. What is the alternative to static libs? Inline header asm stubs?
|
01 June 2024, 23:21 | #4 |
Registered User
Join Date: Jan 2002
Location: Germany
Posts: 7,053
|
You are using vbcc. Just #include <proto/bsdsocket.h> and you are done. No need to link against any net lib.
|
01 June 2024, 23:35 | #5 |
Registered User
Join Date: Jul 2009
Location: Lala Land
Posts: 608
|
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.
|
01 June 2024, 23:53 | #6 |
Semi-Retired
Join Date: Mar 2012
Location: Leiden / The Netherlands
Posts: 2,069
|
I think the posixlib for vbcc also has bsdsocket stuff?
|
02 June 2024, 00:46 | #7 |
Registered User
Join Date: Jul 2009
Location: Lala Land
Posts: 608
|
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.
|
09 June 2024, 13:20 | #8 |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,585
|
The network stuff is confusing with AmigaOS. Main problem here is: although AmiTCP and Roadshow both name their shared library
bsdsocket.librarythe 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_LIBformat, 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.hand 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. |
09 June 2024, 21:56 | #9 |
Registered User
Join Date: Jul 2009
Location: Lala Land
Posts: 608
|
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.
|
13 June 2024, 08:20 | #10 | |
bye
Join Date: Jun 2016
Location: Some / Where
Posts: 696
|
Quote:
|
|
13 June 2024, 10:54 | #11 |
Registered User
Join Date: Jan 2005
Location: Umeå
Age: 44
Posts: 962
|
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.
|
28 July 2024, 18:19 | #12 | |
Registered User
Join Date: Aug 2010
Location: Germany
Posts: 548
|
Quote:
The AmiTCP SDK header files were very useful if you wanted to build the kind of software which AmiTCP already shipped with, such as the "ping" command. It even provided linker libraries which would do most of the library initialization and cleanup for you. The header files themselves were rather, old, though. AmiTCP was originally based upon 4.3BSD Net/2, as ported to MACH. The header files came from Unix and you had to include them in your software in a specific order to fulfill all the necessary dependencies. This made it harder to put them to good use, unless you opted to include everything... This was the state of the art by the time AmiTCP V4 began filling the void, and then some, left by the collapse of Commodore and the dissolution of the Amiga networking group. The AmiTCP V4 SDK header files made you work. Even a small program required patience to figure out which header files to make use of. This was acceptable at the time, until, at least for me, the Miami SDK came around. Not only were the header files and documentation newer, the Miami SDK header files were "cleaner" and much more focused. Couple of years later, when the AmigaOS4 project had finally started, I built an SDK for internal use, both for the AmigaOS 2.x/3.x build (which I used for development on my Amiga 3000UX) and the PowerPC. The SDK header files needed to support both platforms. Which in turn suggested removing everything which was not essential for the APIs of bsdsocket.library to work and for user code to make use of. The BSD socket API is quite compact, and it was comparatively easy to drop what turned out to be used almost exclusively by the BSD Unix kernel code. The current Roadshow SDK header files are still the same for AmigaOS 2.x/3.x and AmigaOS 4. One lesson I learned during AmigaOS 3.5 development was that it is beneficial if the order in which you include certain header files does not matter. If a header file has dependencies, then you better add checks to fulfill them. This makes it easy to plug in the header files you need. Best of all, you could mostly get everything your project requires by including just the <proto/bsdsocket.h> header file, which automatically pulls in the header files related to all its API functions. And this is what we have today |
|
29 July 2024, 03:04 | #13 |
Returning fan!
Join Date: Jan 2011
Location: Montréal, QC, Canada
Posts: 1,456
|
PS. Thanks Olaf! That too could go into a future book
|
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 |
|
|