Okay. After posting that, I realized that "nasmx.inc" *will* work cross-platform. Pretty good trick in itself! I was thrown off by the two different distributions. If you'll recall, you had to tar up the Windows version for me, 'cause I couldn't find an archiver that would decompress the .exe (probably possible, but I don't know how). The two versions overlay each other nicely, without apparent conflict.
The NASMX windows executable file will expand in WINE if you have that installed. The reason that archive readers like file-roller can't open the windows executable is because it's a custom installer, not a compressed .exe file. The file sets up various windows specific environment variables and then extracts everything into the system. I remember when Keith made the installer, it was a wise decision because we were repeatedly bombarded with questions about how to configure NASM and NASMX to work properly under windows, even to the point that many users were claiming that NASMX didn't work on various systems.
In the Linux branch of the "inc" directory, you've got a fairly limited "libc.inc"... which includes some constants which apply even if you're not using C. And "syscall.inc" appears to be just 32-bit... but could be expanded, I guess.
The system dependant syscall.inc was an idea I had back when I was running things that I don't think ever really continued. I was going to make the NASM32 project support two modes; Portable and Platform Dependant. Portable mode was reliant heavily on C based libraries which could be imported as needed. The Platform dependant mode however would have individual include files which extended NASM32 to support each platform's specific features (like system calls), this was more for the asm purists. I got about as far as getting Windows and Linux done but never got around to doing BSD before Keith took over and I don't think he was ever really interested in that aspect of the project, of course most people weren't.
There's going to be a slight "issue" with that, in that "-f elf" and "-f elf32" are the same thing, but result in different "__OUTPUT_FORMAT__"s which don't match. Make 'em use "-f elf32" is probably the easiest workaround to that...
The first thing in NASMX is:
%ifidn __OUTPUT_FORMAT__,elf
%elifidn __OUTPUT_FORMAT__,elf32
%elifidn __OUTPUT_FORMAT__,elf64
%elifidn __OUTPUT_FORMAT__,win32
%define __UNDERSCORE__
%elifidn __OUTPUT_FORMAT__,win64
%define __UNDERSCORE__
%else
%define __CDECL_UNDERSCORE__
%define __UNDERSCORE__
%endif
He could do the same thing in the top of his objects.inc modification but have it make things more specific for him:
%ifidn __OUTPUT_FORMAT__,elf
%define __BASE_FORMAT__ elf
%elifidn __OUTPUT_FORMAT__,elf32
%define __BASE_FORMAT__ elf
%elifidn __OUTPUT_FORMAT__,elf64
%define __BASE_FORMAT__ elf
%elifidn __OUTPUT_FORMAT__,win
%define __BASE_FORMAT__ win
%elifidn __OUTPUT_FORMAT__,win32
%define __BASE_FORMAT__ win
%elifidn __OUTPUT_FORMAT__,win64
%define __BASE_FORMAT__ win
%elifidn __OUTPUT_FORMAT__,macho
%define __BASE_FORMAT__ macho
%elifidn __OUTPUT_FORMAT__,macho32
%define __BASE_FORMAT__ macho
%elifidn __OUTPUT_FORMAT__,macho64
%define __BASE_FORMAT__ macho
%else
%error "unsupported output format."
%endif
This would probably be a good idea anyway as you really don't need to know the difference between 32bit and 64bit OUTPUT_FORMAT in most instances since you can determine your current bit-mode via %[__BITS__] which is more important than the object bit-mode when doing headers.
The Linux "demo1" uses sys_calls, so wouldn't be portable, but a "printf" version probably would...
Heh, yea. There were tons of complains about the demos, but they do what they were designed for. I just tried to show the syntax the best I could since there was no documentation. Also, speaking of the demos, it looks like Keith has been doing some work on the windows demos, there are some new ones I've not seen.
I guess I've actually done a cross-platform example, in a way... Nathan sent me some "experiments" he's doing, using the nasmx include files for the Windows version, and using some of the "socket" APIs. I wrote a "fakeapi.asm", which includes routines of the same name, same parameters, which do "something roughly similar", using syscalls. To my astonishment, it works! I didn't use your "syscall.inc", but I could probably alter it so it did... This is only going to work for a very limited subset of APIs - I don't have much hope for portable GUI apps - but it shows some promise for "console" and "socket" stuff.
Remember, just use a cross platform C library for the system dependant stuff. Things like GTK, Allegro, NCurses, OpenGL, OpenAL, and other cross platform libraries allow you to write code that will build across multiple system without changes to the source.
So yeah... you should maybe "advertise" more. There's more to NASMX than I realized!
Best,
Frank
And here I thought most of these features were pretty well known, like I said, it's the only reason I use it. Other than for cross platform development, I tend to just code using straight NASM.