Author Topic: linux code inside windows binary?  (Read 108 times)

Offline BalticMusicFan

  • Jr. Member
  • *
  • Posts: 4
  • Country: 00
linux code inside windows binary?
« on: February 19, 2018, 02:20:51 AM »
I have been thinking about how to add linux operating system support for own windows program. One way would be running it under Wine and fix any incompatibilities.
On the other hand 64 bit platform provides easy way to code position independent code. I guess NASM would compile same functional linux bytecode into windows binary. That would be more interesting way to prevent duplicating same program logic, where possible.
It would make sense to have three executable sections (one for windows, one for linux and one for code that works for both). I am looking for linux procedures that would be required to pick up latter two in memory.

Any bright ideas?
My primary field is a chemistry, so I might assemble outside limits of Information Technology.

Offline Holmes

  • New Member
  • Posts: 1
Re: linux code inside windows binary?
« Reply #1 on: February 23, 2018, 11:20:59 AM »
No bright ideas unfortunately, but I'm very interested to see if you can pull this off. You're not the first one to try though so good luck!

Offline Cyrill Gorcunov

  • NASM Developer
  • Full Member
  • *****
  • Posts: 170
  • Country: ru
Re: linux code inside windows binary?
« Reply #2 on: February 23, 2018, 10:23:31 PM »
This won't work: OS always figures out the executable from the program header, which of course is different between OS. That said you won't make it work inside one single binary (except of course if you write own windows/linux drivers).