Jump to content

rahimp

Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Posts posted by rahimp

  1. Thanks for your help Adam. I tried what you suggested and things seem to be working out just fine!

    I have to go through my c++ code and convert some things to pointers in order to complete the integration.

    I have one question though, is it possible to send decimal LabVIEW strings into functions in my DLL which accept char *? Basically are LabVIEW strings compatible with C++ or do I have to manipulate the strings in order to put them into an acceptable format before sending to my DLL functions?

    Thanks,

    Rahim

  2. QUOTE(Adam Kemp @ Mar 20 2007, 05:56 PM)

    If you're only using a pointer (i.e., you don't need to actually access the values in G) then tell LabVIEW it's an int32 (by pointer). Then you can just pass that value around into your various other DLL calls without LabVIEW ever having to care what type it is.

    If you need to actually interpret that data in LabVIEW then it's a little trickier.

    I dont need to interpret the data in LabVIEW. I just need to declare a pointer to the data in LabVIEW and then allocate memory for it in c++ and then pass it back into LabVIEW. From there I will be passing the pointer back to the subsequent c++ dll calls.

    What I'm still confused about is what I would initially pass into the dll. For example if my function is as follows:

    void allocateMPEG4 (CMPEG4Streaming *testvariable)

    {

    testvariable = new CMPEG4Streaming();

    }

    Then I would initially need to send pointer testvariable into the function from LabVIEW. Would I simply send in an unsigned 32 bit int? What sort of data type should I be sending into the call library function node? As well on the receiving side of the call library function would I just set the following:

    Parameter: arg1

    Type: numeric

    Data Type: Unsigned 32-bit Integer

    Pass: Pointer to Value

    Or would this configuration be better on the receiving end:

    Parameter: arg1

    Type: Adapt to Type

    Data Format: Handles by Value

    Ideally I'd want my function in C++ to be as follows:

    CMPEG4Streaming *allocateMPEG4 (void)

    {

    CMPEG4Streaming *testvariable = new CMPEG4Streaming();

    return testvariable;

    }

    Is it at all possible to use the funciton return so that I do not have to send anything in from LabVIEW?

    Thanks,

  3. 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!

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.