PDA

View Full Version : A few questions about the command line compiler



Cybermonkey
03-03-2013, 07:23 PM
I learned on pp4s.co.uk how one can use the free command line compiler. Now I wanted to know if it is possible to use third party libraries (e.g. a Java game engine). And if so, how to do it.

Ñuño Martínez
09-03-2013, 06:28 PM
I'm not sure, but I think that it's impossible to use a Java library with Free Pascal or Delphi, as Java uses a Virtual Machine (https://en.wikipedia.org/wiki/Virtual_machine). Anyway you can use third party libraries if you have the interface.

For example, Allegro.pas (http://allegro-pas.sf.net/) is actually the interface to use the Allegro (http://alleg.sf.net/) library, which is written in C. Also, the GL/OpenGL units (one for FPC, the other for Delphi) are actually the interfaces to use the OpenGL library, which is (often) written in C too. Actually you can use most libraries written in C without problems. Other languages than C are a bit tricky, but some are just impossible as Java (except you're using a Pascal compiler that generates a Java executable like Oxygene IIRC). C++ is also one of these "non compatible with" language. Well, actually you can use C++ in (Object) Pascal, but it's too much complex.

So you just need the interface. If you haven't it then you can write it by yourself. Of course you'll need some knowledge about the language to success.

Cybermonkey
09-03-2013, 07:31 PM
Erm, this was posted in the Oxygene for Java board so I am not referring to FreePascal or Delphi here...

Ñuño Martínez
11-03-2013, 10:11 AM
Erm, this was posted in the Oxygene for Java board so I am not referring to FreePascal or Delphi here... Ups! :-[ My fault. Sorry.

WILL
05-08-2013, 07:45 AM
Wow I guess this thread is a bit old, but here goes anyhow. :)

Paul and I have been using libGDX (http://libgdx.badlogicgames.com/) quite successfully for our game on the OUYA. Supports and runs on Android phones and tablets and even the mighty OUYA gaming console. All you really need to do is include your library's jar files and make calls towards their classes.

Oxygene for Java is kind of like a superset of Object Pascal in that it incorporates a lot of the Java language functions into it, however the language is still very much Object Pascal with a few exceptions. This allows you to use suh libraries without the need to create all these translated wrappers. It does this rather elegantly actually.

Correct me if I'm wrong anywhere here Paul.

pstudio
05-08-2013, 08:47 AM
Yes it is possible. It is one of the great strengths of Oxygene IMO. We have the entire selection of Java libraries available. Oxygene even translates all get/set methods to properties so that you don't e.g. have to write object.setX(object.getX() + 5) all the time but can just write inc(object.x, 5) which is way more Pascalish.

Cybermonkey
05-08-2013, 12:27 PM
But that's all possible with the free command line compiler? Cool, I'll have a closer look soon.