Hello All,
I'm looking to use some c++ code in my labview application using the call function library function. I have a class in C++ which is a custom data type. I need to send this variable into my c++ functions. I want to allocate memory for it inside one of my dll functions and pass a pointer to it back to labview. I want to use this pointer to pass through to all my subsequent functions requiring the pointer. I have been looking online for support for custom data types in labview dlls and cannot seem to find any acceptable solutions.
I have attached the C++ code for my data type below. Any help will be greatly appreciated.
#include "wmsdk.h"
#include "wmsysprf.h"
#include "mil.h"
#include "stdio.h"
#include "conio.h"
#include <assert.h>
class CMPEG4Streaming
{
public:
CMPEG4Streaming();
~CMPEG4Streaming();
bool SetStreamingParameters( int PortNum, const WCHAR * ArchiveFile, int VideoSizeX, int VideoSizeY, int AvgTimePerFrame, int RateControl);
inline int GetStreamingVideoSizeX(){ return m_VideoSizeX;}
inline int GetStreamingVideoSizeY(){ return m_VideoSizeY;}
bool StreamSample( void *DataPtr, int NumBytes, bool IsIFrame, unsigned long long cnsSampleTime);
private:
//We have 1 profile manager, and then 1 profile PER Stream
static IWMProfileManager *m_pProfileMgr;
static int CMPEG4StreamingInstanceCount;
IWMProfile *m_pProfile;
IWMWriter *m_pWriter;
IWMWriterAdvanced *m_pWriterAdvanced3;
IWMWriterNetworkSink *m_pWriterNetworkSink;
IWMWriterFileSink *m_pWriterFileSink;
int m_FirstIFrame;
DWORD m_PortNum;
const WCHAR * m_ArchiveFile;
int m_VideoSizeX;
int m_VideoSizeY;
//int m_VideoFormat;
//int m_VideoResolution;
void PrintErrorMessage( char *, HRESULT);
HRESULT CreateProfile( int PortNum, const WCHAR * ArchiveFile, int VideoSizeX, int VideoSizeY, int AvgTimePerFrame, int RateControl);
HRESULT ModifyProfile( int PortNum, const WCHAR * ArchiveFile, int VideoSizeX, int VideoSizeY, int AvgTimePerFrame, int RateControl);
HRESULT FillConfig ( IWMStreamConfig *pConfig, int VideoSizeX, int VideoSizeY, int AvgTimePerFrame, int RateControl);
HRESULT SetSinks ( unsigned long PortNum, const WCHAR * ArchiveFile);
};
Basically I need to be able to get a pointer to CMPEG4Streaming inside labview by allocating memory for it in my c++ dll.
My dll function would be something like this:
void allocateMPEG4 (CMPEG4Streaming *testvariable)
{
testvariable = new CMPEG4Streaming();
}
I would then pass the pointer returned in labview to all my subsequent functions in the dll.
Thanks!