I'm not an expert on all of the different compilers and toolchains in DOS and I prefer to keep things simple by sticking to one toolchain at a time. However, there are a few calling conventions and most of the compilers can be made to choose between their default and others. For example, I know that the Watcom compiler that I use can generate code that can be linked with Microsoft tools. I think. ;-0 There are a lot of details though.
Rather than trying to mix and match toolchains it is easier to port the pieces of code that you need to the other compiler. mTCP initially started with Turbo C++ but after a few years I decided to move to Open Watcom. For a while I tried to keep things compiling under both compilers but that was a lot of work, especially when I was having to use inline assembler to speed things up. Most of the code is C++ that looks like C so if you "undo" my assembler optimizations and get back to the C++ or C code, it should be very portable to other compilers.
Some specific observations on your last reply:
- FreeDOS ships mTCP but that is about it. The networking enabled FreeDOS package manager is actually using WATT32.
- While I don't ship pre-compiled libraries with mTCP, that's actually a good thing. Mixing and matching compilers and toolchains is troublesome; I prefer the porting approach described above, especially for smaller amounts of code. And that also allows you to choose the memory model; mTCP programs can support all of the DOS memory models. I've never bothered with the HUGE model but I know that all of the others work.
- I use a lot of #defines to allow you to add or strip out features that you don't need.
For your project you'll need some of my packet layer code to interface with the packet driver and the Ethernet, IP and UDP includes and code. A lot of it can be cut out:
- You don't need any of the IP fragments code, and there is a lot of code there.
- There are two UDP send functions, one that requires the caller to reserve space for the Ethernet and IP headers and one that does not but uses malloc instead. Use the first variant for space and performance reasons.
- Anywhere you see a function call to the C runtime library try to get rid of it. Things like memcpy can easily be replaced with your own local function. The idea is to have pure C code that runs with a minimum amount of support from the C runtime library - just like assembler code.
- Strip out the tracing code, the timer hook and management code, etc. Tracing is nice but it takes up space so remove it if you can. The timer management code was needed for TCP retry support and general time keeping, but you won't need it on something this small.
As a starter exercise, start with the mTCP code and the Netcat program. Convert Netcat to send UDP packets instead of opening an TCP/IP socket. Then start stripping *everything* you can. Once you get to the bare minimum that is enough to send a UDP packet with minimal calls to the C runtime library you are ready to port that code to the other compiler and integrate it with SoftMPU.