GLBasic can now include native C functions and files w/o INLINE:
Main.gbas file
REQUIRE "test1.cpp" // advise the compiler to take a cpp file, too
IMPORT "C" int Muh(); // IMPORT is like "extern" in C++. All the rest is the same.
Muh() // call it
test1.cpp
#include "glb.h"
extern "C" int Muh()
{
STDOUT("Muh!");
}
cooooooooool!
Excellent Gernot, thank you, could we have a mini tutorial please specifying...
- What variable types can be used within GLBasic
- How pointers are dealt with?
- Is it possible to pass C structures, if so, how is this used within GLBasic?
- Anything else regarding passing data back and forth ;)
Overall a big :good: from me!
really good news! top!
@bigsofty
let's try it out :) I hope it's possible to use class definitions within the cpp files
It'll make things easier
no structure passing. Make that inline or a wrapper. type conversion is:
int, long, short, char, void* -> DGNat
double, float -> DGInt
int& -> DGNat BYREF
double& -> DGInt BYREF
char*, const char* -> DGStr
is this feature ready for download in Beta Release?
Ooooh I like INLINE though!
I like this idea a lot too though. :) Definitely a cool feature.
Quote from: Ocean on 2009-Aug-05
Quote from: Hatonastick on 2009-Aug-05
Ooooh I like INLINE though!
it's not mutually exclusive, so.... :)
Darn, so there's no point ranting, raving and demanding it be put back the way it was then? =D
That IMPORT-Functions need to highlight on the IDE...( and Autocompletion/ see the parameters on the "tooltip" at the bottom of the IDE)
Gernot, realy good work!
I can create my "Menu wrapper" from windows.h with that. (without a DLL and YES i can include <windows.h>... but <iostream> crashs) :)
Works fine :good:
The line, which IMPORT is written on, is highlighted blue, with the new black theme.
But the declaration itself(IMPORT), and the declared command words are not highlighted.
Question: This new command import, is it the same thing as setting up an inline?
Import allows access to the function included by Require - its somewhat like Declare.
@ Hemlos:
http://www.glbasic.com/forum/index.php?topic=3059.msg23907#msg23907
Quote from: Kitty Hello on 2009-Aug-05
no structure passing. Make that inline or a wrapper. type conversion is:
int, long, short, char, void* -> DGNat
double, float -> DGInt
int& -> DGNat BYREF
double& -> DGInt BYREF
char*, const char* -> DGStr
Whoops missed this reply, thanks Gernot! =D