flat assembler
Message board for the users of flat assembler.
Index
> Main > multiplatform code |
Author |
|
l_inc 15 Jul 2015, 17:19
roxaz
You just create a main file for each individual platform and then use the include directive to include the platform independent code located in separate files. Effectively this creates a differentiation of the target platform by altering the command line: fasm lin_project.asm vs. fasm win_project.asm . _________________ Faith is a superposition of knowledge and fallacy |
|||
15 Jul 2015, 17:19 |
|
cod3b453 15 Jul 2015, 18:04
I usually use the two files method l_inc mentioned, as it allows greater flexibility/capability where platform specific differences are required, but you can also have two different common headers that you reference using environment variables. This works nicely for native platform assembly but is more annoying for cross platform assembly, since you'd have to toggle the environment variable.
e.g. <path>/common/win64/common.fash (format PE64 GUI) <path>/common/lin64/common.fash (format ELF64 executable 3) Set COMMON to the appropriate <path>/common/<platform> and then: Code: include '%COMMON%/common.fash' ; YOUR CODE HERE |
|||
15 Jul 2015, 18:04 |
|
PeExecutable 15 Jul 2015, 21:08
The general wisdom today is to create multi platform programs. Just remember that you don't need to do this, only large commercial software developers really need to make cross platform programs (and they don't want to do that, they just need to, if you personally can avoid it, you should avoid it)
Do not be afraid to write programs that only works for one specific type of platform. Idiots try to make their program work for any platform, and pioneers try to drag people over to using the platform they prefer. Do not be afraid to try to be a pioneer, when you create a program for one specific type of platform, you increase the probability that a user will switch to that platform, permanently. Just remember that your goal is not to make everything work for any platform, your ultimate goal is to make one platform more attractive than the next. THATS wisdom. So do not be afraid to disappoint any users out there. Try to tempt them to switch platform. The reason some people prefer one platform over the other is because some features work better on one platform than the other. What you should do, is to prefer the one that works better and encourage users to switch to the one you think is better. The term 'cross platform apps' is just a very ugly spell that has been cast upon people, they don't even know why they are doing it. The general approach is to "satisfy everyone", but the approach should be to invite people to become satisfied, it's not the other way around. It's not about adapting to a thousand different "rats" in the world, it's about killing all the rats, and then buy a very nice big dog that you can pet. |
|||
15 Jul 2015, 21:08 |
|
roxaz 16 Jul 2015, 06:31
Thanks guys, i totally did not think of env variables and includes. After all its multiple years after i last did any coding with fasm.
@PeExecutable: you are right, not every platform has to work, but main ones has because im working on compiler feature. So goal is to make it at least work on x86/x64/windows/unixes. Luckily this is all covered by basically 3 different platform-dependent sets of code: cdecl and fastcall for x86 is same on both unixes and windows, then we have ms x64 abi and sysv x64 abi. So not much work really. Ofc there is at least arm too on the horizon but thats for later. If you are wondering which compiler here is shameless advertisement: http://nim-lang.org/ |
|||
16 Jul 2015, 06:31 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.