PDA

View Full Version : irrklang headers for pascal



arthurprs
13-10-2007, 03:26 AM
Today i was programming in c++ and a parter told me to use irrKlang audio lib http://www.ambiera.com/irrklang

i liked a lot¬?, easy to use and very powerfull

so i like to convert the headers to my prefered language :)

fist i need some help how to c++ -> ObjectPascal types,
what i typed is correct?

and what i do with namespaces in pascal?


namespace irr
{
//! 8 bit unsigned variable.
typedef unsigned char u8; //byte;

//! 8 bit signed variable.
typedef signed char s8; //shortint;

//! 8 bit character variable.
typedef char c8; // char;

//! 16 bit unsigned variable.
typedef unsigned short u16; //word;

//! 16 bit signed variable.
typedef signed short s16; //smallint;

//! 32 bit unsigned variable.
typedef unsigned int u32; //cardinal;

//! 32 bit signed variable.
typedef signed int s32; //integer;

//! 32 bit floating point variable.
typedef float f32; //single;

//! 64 bit floating point variable.
typedef double f64; //double;
} // end namespace

arthurprs
13-10-2007, 05:05 AM
I have noticed that the headers are different (c++ headers), i don't know from where to start... :( dead before born?

Brainer
13-10-2007, 07:47 AM
According to Delphi 6 Developer's Guide:
Byte -> unsigned short
Shortint -> unsigned char
Char -> char
Word -> unsigned short
Smallint -> short
Cardinal -> unsigned long
Integer -> int
Single -> float
Double -> double

Hope that helps :!: :wink:

JSoftware
13-10-2007, 08:24 AM
You can kind of emulate namespaces in pascal by naming the unit where the definitions are residing the equivalent name as used in the c++ namespace

Srki_82
13-10-2007, 01:41 PM
If some of functions returns or require C++ classes for parameters then you will have to write wrapper library and headers for that wrapper. Look at IrrPascal wrapper... it is far from finish, but it can help you start.

arthurprs
13-10-2007, 03:20 PM
If some of functions returns or require C++ classes for parameters then you will have to write wrapper library and headers for that wrapper. Look at IrrPascal wrapper... it is far from finish, but it can help you start.

The library have a 1 main device class that have all the other classes, functions and procedures,
and yes sometimes function returns classes

I downloaded irrPascal, but you an you explain more wrapper lib?

Srki_82
14-10-2007, 03:23 PM
This article explains all about using C++ objects in Pascal/Delphi
http://rvelthuis.de/articles/articles-cppobjs.html

arthurprs
14-10-2007, 05:19 PM
This article explains all about using C++ objects in Pascal/Delphi
http://rvelthuis.de/articles/articles-cppobjs.html

Very usefull article, favorited,

now i can start the header translation :)