Importing C/C++ files

BlitzMax Forums/BlitzMax Programming/Importing C/C++ files

cloned(Posted 2009) [#1]
I was browsing through the blitzmax source and noticed that a few mods import C files.

I was wondering, what are the limits to this. I was planning on making some AI code in C++ while using blitzmax to make the test app. I want to save time on implementing a graphics engine and controls so I can focus on the AI part of it.


plash(Posted 2009) [#2]
Tutorial for C:
http://www.blitzbasic.com/Community/posts.php?topic=82509

Importing C++/STL tutorial:
http://www.blitzbasic.com/Community/posts.php?topic=67634

Interfaced class (in a thread about COM/DirectX):
http://www.blitzbasic.com/Community/posts.php?topic=62307#696590

EDIT: Oh, and if you want to get really crazy, take a peek at basically any of Brucey's modules (wxMax in particular is a good example of the 'limits' -- none, really!).


cloned(Posted 2009) [#3]
Thanks, this should really help.


Digital Anime(Posted 2009) [#4]
@Plash, This should help me a bit as well, thanks a lot.

One more question about structures in C++, is that the exact same thing as a type with some fields in Blitzmax?


plash(Posted 2009) [#5]
One more question about structures in C++, is that the exact same thing as a type with some fields in Blitzmax?
Pretty much.

All instances 'structs', 'classes', 'types', etc. usually end up in the programmers hands as a Byte Ptr (a pointer to the beginning of the instance of a struct).
A (comparatively) small example of how structs/objects are handled is my mono wrapper. All the external functions have been defined as using Byte Ptrs for parameters that require an object.

I've also wrapped all of Mono's structs into a BlitzMax type (notice how all the functionality depends on the internal instance of the real object from Mono - wxMax does this too).