-
Writing a Wrapper
Hello, I'm kinda new here and I don't know how it rolls here, but:
I'm trying to write a wrapper of the Havok Physics Source for a well known game prgram called Game Maker. I've been reading the HELP file for Havok and I learned some basic C++ a couple of months ago, along with the basic of making a DLL for Game Maker. My main difficulty is the fact that I'm using Dev-C++ to write the wrapper when the HELP file is based off MSVisual. I finally got the DLL to include all the headers it needs, and there's a bunch of classes with functions. The problem is that when I place a piece of code from the help file like this:
Code:
hkpWorldCinfo info;
info.m_simulationType = hkpWorldCinfo::SIMULATION_TYPE_DISCRETE;
info.m_gravity.set( 0,-9.8f,0);
info.m_collisionTolerance = 0.1f;
info.setBroadPhaseWorldSize( 150.0f );
info.setupSolverInfo( hkpWorldCinfo::SOLVER_TYPE_4ITERS_MEDIUM );
m_world = new hkpWorld( info );
I keep getting errors with undeclared things and functions not working (I'm guessing the functions come from the classes). I'm using the recent Havok Source for PC which is available on the Havok website.
-
hkpWorldCinfo must be defined somewhere. Try looking in the help file as to where it might be.
Then include that header file that it says it exists in. That should take care of the undeclared errors.
-
Well, in the classes, I can very well see that hkpWorldCinfo has been placed, but it still returns the "undeclared"...
This is what I placed in the Header file to include, the Help File said that it was all that was needed for the basics
Code:
// Include the hkbase header before any other hkbase includes.
#include <Common/Base/hkBase.h>
#include <Common/Base/System/Io/IStream/hkIstream.h>
// more hkbase headers
// Include the hkdynamics header before any other hkdynamics includes.
#include <Physics/Dynamics/hkpDynamics.h>
#include <Physics/Dynamics/World/hkpWorld.h>
// more hkdynamics headers
I'm getting really confused, I looked at other DLLs (from examples) and it should technically work...
-
the library is probably enclosed in one or more namespaces...
-
That's possible, that means that it's possible two functions or variables use the same name... I tried changing the 'export double (function)()' with a function that wasn't used before, but I still get that same error. I don't know what I'm doing wrong, it's my first time writing a DLL, but not my first time using C++ (only basic C++ though). Is it possible that it's a compiler fault?
-
>> That's possible, that means that it's possible two functions or variables use the same name...
well, no, it just means you need to prepend the type name with the appropriate namespace(s).
>> Is it possible that it's a compiler fault?
not likely. ;)
-
OK, but it still doesn't seem to do anything, I'll try re-creating the DLL and see what happens...