1. Euphoria 32 & 64 Bits
- Posted by Icy_Viking Aug 03, 2021
- 1815 views
Is there a way to set Euphoria up so that it can run 32-bit programs and 64-bit programs? DLLs that use fastcall won't run in 32-bit Eu, but they will run in 64-bit. So is there a easy way to set this up?
2. Re: Euphoria 32 & 64 Bits
- Posted by petelomax Aug 03, 2021
- 1812 views
Alas I cannot tell you a single relevant thing about that in Euphoria, but in Phix requires(32) and requires(64) will either be silent or go look for a more suitable interpreter and offer to restart using that.
Personally I often simply rely on p.exe (and pw.exe) being 32 bit and p64.exe being 64 bit (but usually don't bother with even having a pw64.exe).
4. Re: Euphoria 32 & 64 Bits
- Posted by Icy_Viking Aug 03, 2021
- 1795 views
Alas I cannot tell you a single relevant thing about that in Euphoria, but in Phix requires(32) and requires(64) will either be silent or go look for a more suitable interpreter and offer to restart using that.
Personally I often simply rely on p.exe (and pw.exe) being 32 bit and p64.exe being 64 bit (but usually don't bother with even having a pw64.exe).
I think Euphoria would benefit from having a 32-bit and 64-bit interprer in one package. Mostly though the 64-bit version is what I need for when DLLs use the FastCALL convention. I guess I could edit the C source code and change it to cdecl or something, but that would be even more work. I guess it could possibly be worth it in the end. Maybe Greg will have some info?
5. Re: Euphoria 32 & 64 Bits
- Posted by ghaberek (admin) Aug 04, 2021
- 1809 views
Is there a way to set Euphoria up so that it can run 32-bit programs and 64-bit programs? DLLs that use fastcall won't run in 32-bit Eu, but they will run in 64-bit. So is there a easy way to set this up?
I think the "easist" method would be to put the 32-bit binaries in C:\Euphoria\bin32 and 64-bit binaries in C:\Euphoria\bin64, rename all of the executables to "eui32.exe" or "eui64.exe" respectively.
Then put both paths in your PATH (I'd put bin64 first) and then remove the original C:\Euphoria\bin. And don't forget to update the contents of eu.cfg in each new "bin" directory as well.
I think Euphoria would benefit from having a 32-bit and 64-bit interprer in one package. Mostly though the 64-bit version is what I need for when DLLs use the FastCALL convention. I guess I could edit the C source code and change it to cdecl or something, but that would be even more work. I guess it could possibly be worth it in the end. Maybe Greg will have some info?
I assume we're talking about Orx here? I haven't tried compiling it yet (which uses Rebol and Premake) but hypothetically, you should just have to update the orxFASTCALL macro in orxDecl.h.
Since it's ifdef'd, you may even be able to override it on the command line, like make orxFASTCALL= without having to edit the header files directly.
-Greg
6. Re: Euphoria 32 & 64 Bits
- Posted by Icy_Viking Aug 04, 2021
- 1819 views
Is there a way to set Euphoria up so that it can run 32-bit programs and 64-bit programs? DLLs that use fastcall won't run in 32-bit Eu, but they will run in 64-bit. So is there a easy way to set this up?
I think the "easist" method would be to put the 32-bit binaries in C:\Euphoria\bin32 and 64-bit binaries in C:\Euphoria\bin64, rename all of the executables to "eui32.exe" or "eui64.exe" respectively.
Then put both paths in your PATH (I'd put bin64 first) and then remove the original C:\Euphoria\bin. And don't forget to update the contents of eu.cfg in each new "bin" directory as well.
I think Euphoria would benefit from having a 32-bit and 64-bit interprer in one package. Mostly though the 64-bit version is what I need for when DLLs use the FastCALL convention. I guess I could edit the C source code and change it to cdecl or something, but that would be even more work. I guess it could possibly be worth it in the end. Maybe Greg will have some info?
I assume we're talking about Orx here? I haven't tried compiling it yet (which uses Rebol and Premake) but hypothetically, you should just have to update the orxFASTCALL macro in orxDecl.h.
Since it's ifdef'd, you may even be able to override it on the command line, like make orxFASTCALL= without having to edit the header files directly.
-Greg
I could try that for Orx. Also, that is a idea for the 32 and 64-bit versions of Euphoria. Thanks Greg.
7. Re: Euphoria 32 & 64 Bits
- Posted by SDPringle Sep 23, 2021
- 1525 views
include std/machine.e if machine::ADDRESS_LENGTH = 8 then -- 64 bit code here else -- 32 bit code here end if
You can wrap branches like this into functions to assign to DLL constants.
8. Re: Euphoria 32 & 64 Bits
- Posted by petelomax Sep 23, 2021
- 1527 views
if machine::ADDRESS_LENGTH = 8 then
Is that really a double colon?
FYI, Phix has machine_word() [4 or 8] and machine_bits() [32 or 64], both of which are resolved by the front end, which then goes on to completely optimise away both the test itself and all of the unnecessary branch's code block.
9. Re: Euphoria 32 & 64 Bits
- Posted by ghaberek (admin) Sep 23, 2021
- 1579 views
if machine::ADDRESS_LENGTH = 8 then
Is that really a double colon?
FYI, Phix has machine_word() [4 or 8] and machine_bits() [32 or 64], both of which are resolved by the front end, which then goes on to completely optimise away both the test itself and all of the unnecessary branch's code block.
No. Maybe he meant a single colon, but the most "correct" way to handle platform differences should be to use ifdef blocks like this:
ifdef BITS64 then /* 64-bit code here */ elsedef -- BITS32 /* 32-bit code here */ end ifdef
While you could also use BITS32, this method is backwards-compatible with Euphoria 4.0 since BITS64 won't exist on that version, and it will fall through to the elsedef condition automatically.
Euphoria 4.1 also added architecture definitions for X86, X86_64, and ARM (32-bit). I'm hoping to get 64-bit ARM builds working as well, which would probably rename ARM to ARMHF and add AARCH64.
Of course memstructs will take care of most of this by dealing with pointers and whatnot automatically. I've been working on some real-world testing with memstructs to make sure it's stable enough for use.
-Greg
10. Re: Euphoria 32 & 64 Bits
- Posted by Icy_Viking Sep 24, 2021
- 1497 views
if machine::ADDRESS_LENGTH = 8 then
Is that really a double colon?
FYI, Phix has machine_word() [4 or 8] and machine_bits() [32 or 64], both of which are resolved by the front end, which then goes on to completely optimise away both the test itself and all of the unnecessary branch's code block.
No. Maybe he meant a single colon, but the most "correct" way to handle platform differences should be to use ifdef blocks like this:
ifdef BITS64 then /* 64-bit code here */ elsedef -- BITS32 /* 32-bit code here */ end ifdef
While you could also use BITS32, this method is backwards-compatible with Euphoria 4.0 since BITS64 won't exist on that version, and it will fall through to the elsedef condition automatically.
Euphoria 4.1 also added architecture definitions for X86, X86_64, and ARM (32-bit). I'm hoping to get 64-bit ARM builds working as well, which would probably rename ARM to ARMHF and add AARCH64.
Of course memstructs will take care of most of this by dealing with pointers and whatnot automatically. I've been working on some real-world testing with memstructs to make sure it's stable enough for use.
-Greg
ifdef statements are the way to go IMO. Also, that memstruct feature will be very hand, especially for wrapping libraries. Can't wait for it!