Hi guys, I want to build a DLL to access classes and functions from a Visual Basic program
This right here is my class
class SimpleDevice : public IHaptikDevice
{
private:
// Callback Related
PVOID object;
PVOID method;
UINT32 timerId;
// State
HaptikData data;
HaptikUserData userdata;
public:
static Vector3 startPosition;
static bool buttonPressed;
// IHaptik interface
public:
UINT32 Init(PVOID inMethod,PVOID inObject);
UINT32 Start();
UINT32 Stop();
UINT32 Release();
UINT32 Read(HaptikData& data);
UINT32 Write(HaptikData& data);
UINT32 SetRate(FLT32 rateInHz);
FLT32 GetRate();
UINT32 GetInfo(HaptikDeviceInfo& info);
UINT32 SetUserData(DWORD userData);
DWORD GetUserData();
UINT32 SetCallback(PVOID method = NULL,PVOID object = NULL, DWORD reserved = NULL);
UINT32 GetCallback(PVOID& method,PVOID& object = NULL_REFERENCE(PVOID),DWORD reserved = NULL);
UINT32 GetLastError();
UINT32 GetCalibrationStatus();
UINT32 Recalibrate(UINT32 reserved = NULL);
public:
VOID Callback();
public:
SimpleDevice();
~SimpleDevice();
};
After making a New Project Windows Application DLL Export Library I started making my export classes (there are two, which access a special header from Haptik Library to control my Novint falcon)
So I did this
#ifdef FALCON_PLUGIN_EXPORTS
#define FALCON_PLUGIN_API __declspec(dllexport)
#else
#define FALCON_PLUGIN_API __declspec(dllimport)
#pragma message("Automatic Link to Falcon_Plugin.lib")
#pragma comment(lib, "Falcon_Plugin.lib")
#endif
////////////////////
// List of #Includes
/////////////////////
class FALCON_PLUGIN_API SimpleDevice : public IHaptikDevice
{
private:
// Callback Related
PVOID object;
PVOID method;
UINT32 timerId;
// State
HaptikData data;
HaptikUserData userdata;
public:
static Vector3 startPosition;
static bool buttonPressed;
// IHaptik interface
public:
UINT32 Init(PVOID inMethod,PVOID inObject);
UINT32 Start();
UINT32 Stop();
UINT32 Release();
UINT32 Read(HaptikData& data);
UINT32 Write(HaptikData& data);
UINT32 SetRate(FLT32 rateInHz);
FLT32 GetRate();
UINT32 GetInfo(HaptikDeviceInfo& info);
UINT32 SetUserData(DWORD userData);
DWORD GetUserData();
UINT32 SetCallback(PVOID method = NULL,PVOID object = NULL, DWORD reserved = NULL);
UINT32 GetCallback(PVOID& method,PVOID& object = NULL_REFERENCE(PVOID),DWORD reserved = NULL);
UINT32 GetLastError();
UINT32 GetCalibrationStatus();
UINT32 Recalibrate(UINT32 reserved = NULL);
public:
VOID Callback();
public:
SimpleDevice();
~SimpleDevice();
};
Am i on the right direction? Also when I'm declaring the functions I do:
[I]type[/I] SimpleDevice::[I]Function_Name[/I]<[I]body[/I]>