cross compilation & java bytecode

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
DoubleDutch
Addict
Addict
Posts: 3220
Joined: Thu Aug 07, 2003 7:01 pm
Location: United Kingdom
Contact:

cross compilation & java bytecode

Post by DoubleDutch »

I mentioned previously that cross compilation to one of the other versions of purebasic would be great, i.e compile an amiga or linux program in the microsoft version. etc

But also a version that will compile to Java Bytecode would be GREAT!!!

This would allow PureBasic programs to run on almost any system. Of course only a subset of the commands would work, but it would still be good.
Froggerprogger
Enthusiast
Enthusiast
Posts: 423
Joined: Fri Apr 25, 2003 5:22 pm
Contact:

Post by Froggerprogger »

Yes, that would be wonderful !

[In fact I sometimes used PB together with Java: in the way calling PB-DLL-functions as native Java-functions and for the actual project I write the GUI in PB and let Java do some calculation (because of full doubles & int64 support - and it is possible to encapsulate the java-part to let it run on all machines at the university - via SSH :) )]

Perhaps it would be the easiest way to write a sourcecode-parser that 'simply' translates your PB-code to Java-source and then compile that to bytecode using an installed java-compiler. This should give no problems with all datatypes, maths, arrays, linked lists, loops, ifs, procedures, and perhaps even the window-lib (perhaps - I never used e.g. swing yet) and some others (file, network,...) etc.

But there will exist problems with the 3D-engine and the main limitation that Java doesn't support pointers of any kind. So you cannot directly address the memory (for Peek/Poke/@/? and all this stuff). This is all done by Java Runtime itself (and seems to be necessary for this huge crossplatform-compatibility) But perhaps you could make a workaround using bytearrays for this.

OK - Fred ? Do you think this is possible for you until May ? pleeease :D
%1>>1+1*1/1-1!1|1&1<<$1=1
KarLKoX
Enthusiast
Enthusiast
Posts: 681
Joined: Mon Oct 06, 2003 7:13 pm
Location: France
Contact:

Post by KarLKoX »

yes, it would be an excellent feature to let purebasic to be more and more popular but this is a very BIG task.
Perhaps for pb 6.0 or 7.0 :roll:
"Qui baise trop bouffe un poil." P. Desproges

http://karlkox.blogspot.com/
freak
PureBasic Team
PureBasic Team
Posts: 5940
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post by freak »

If you want Java Bytecode, why don't you use... Java? :P
quidquid Latine dictum sit altum videtur
techjunkie
Addict
Addict
Posts: 1126
Joined: Wed Oct 15, 2003 12:40 am
Location: Sweden
Contact:

Post by techjunkie »

freak wrote:If you want Java Bytecode, why don't you use... Java? :P
Yeah - I agree... Java would only be a very small part of PB with it's limitation and so on - and lets face it Java is JAVA, Pure Basic is BASIC... It really doesn't "fit" in the Pure Basic concept and for example... What GUI should you use? Swing classes? Should it support Java 2? Applets or only native Java code?

Better with a Pure Basic plug-in in that case... as Clickteam have done with Jamagic.

That's my opinion... :roll:
Image
(\__/)
(='.'=) This is Bunny. Copy and paste Bunny into your
(")_(") signature to help him gain world domination.
User avatar
DoubleDutch
Addict
Addict
Posts: 3220
Joined: Thu Aug 07, 2003 7:01 pm
Location: United Kingdom
Contact:

Post by DoubleDutch »

I don't know if I was being clear enough...

I mean compile to the virtual machine bytecode, not to the java language. Its the bytecode thats interpreted, not the Java source. Thus to Fred its just another machine to compile to, like the 68k or others.

This way the resultant file will run on any system that has implemented a Java interpreter.

In any event, even if you think that "JavaByteCode" output is a long way off, possibly cross compilation between the 2 x86 BASIC versions (Linux and Microsoft) isn't?

What do you reckon Fred?
techjunkie
Addict
Addict
Posts: 1126
Joined: Wed Oct 15, 2003 12:40 am
Location: Sweden
Contact:

Post by techjunkie »

DoubleDutch wrote:I mean compile to the virtual machine bytecode, not to the java language. Its the bytecode thats interpreted, not the Java source. Thus to Fred its just another machine to compile to, like the 68k or others.
Yes - but you still will be stuck with the limitations (and speed) of Java... and need all the Sun JRE-stuff... and I don't see the point really - of the 660 Pure Basic command, you maybe can use 100 - 200 for use in Java bytecode (at most)... (my guess - can be totally wrong)

No DirectX access, no access to hardware, no access to the filesystem (if you run it as an applet), different GUI - you have to remake PB totally...

To generate Java bytecode, isn't the same as for example generate XBox binaries. There you have the same foundation and can use the same dll's.

I CAN see the point if you wanna do a simple 2D game in Pure and then generate Java bytecode, so you can run it on different platforms - it's the only use I can see... and the most easy implementation... That would be pretty cool...

If you wanna use GUI and so on... GOD, what a workload for Fred... *L*

Why not generate code that you can run with MS .NET Framework to begin with? :-)
Image
(\__/)
(='.'=) This is Bunny. Copy and paste Bunny into your
(")_(") signature to help him gain world domination.
techjunkie
Addict
Addict
Posts: 1126
Joined: Wed Oct 15, 2003 12:40 am
Location: Sweden
Contact:

Post by techjunkie »

techjunkie wrote:Why not generate code that you can run with MS .NET Framework to begin with? :-)
For the record: I hate :twisted: MS .NET Framework... :twisted:

:lol:
Image
(\__/)
(='.'=) This is Bunny. Copy and paste Bunny into your
(")_(") signature to help him gain world domination.
Shannara
Addict
Addict
Posts: 1808
Joined: Thu Oct 30, 2003 11:19 pm
Location: Emerald Cove, Unformed

Post by Shannara »

Same here, why generate scripts when you can generate real code?
Post Reply