LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I initialize Path_t in VC++

LabView 8.5
VC++ 2008

Hi,

I am a Newbiee in Labview and I have a question to the variables in LabView-DLLs
I have created my own LabView-DLL (very easy, very nice) with a Path-variable as input.
I get the header file MyDll.h with the line

void __cdecl ReadSetupFile(Path *basePath, TD1 *outputCluster);

to Path I found the code in the from LabView creatred file extcode.h

#define LV_PRIVATE_POINTER_FWD(T)    typedef struct T##_t *T /* for forward declarations */

/** @struct Path
Opaque type used by the path manager. See pathmgr.cpp
declared here for use in constant table */
LV_PRIVATE_HANDLE(Path);

now I declared in m< main program

    TD1 outputCluster;
    Path basePath;

and run

    ReadSetupFile(&basePath, &outputCluster);

outputCluster is a structure easy to read and to write but I have problems with the LavView variable "basePath"

The solution of Path is

typedef Path_t ** Path

All trials like

    basePath = "C:\blabla";
    *basePath = "C:\blabla";
    **basePath = "C:\blabla";
   basePath.    ...
    *basePath.    ...
    **basePath.    ...
    basePath->    ...
    *basePath->    ...
    **basePath->    ...

are not running.

How can I handle this?

Regards

Jens
0 Kudos
Message 1 of 2
(2,713 Views)


@JensKutsche wrote:
LabView 8.5
VC++ 2008

Hi,

I am a Newbiee in Labview and I have a question to the variables in LabView-DLLs
I have created my own LabView-DLL (very easy, very nice) with a Path-variable as input.
I get the header file MyDll.h with the line

void __cdecl ReadSetupFile(Path *basePath, TD1 *outputCluster);

to Path I found the code in the from LabView creatred file extcode.h

#define LV_PRIVATE_POINTER_FWD(T)    typedef struct T##_t *T /* for forward declarations */

@/** @struct Path
Opaque type used by the path manager. See pathmgr.cpp
declared here for use in constant table */
LV_PRIVATE_HANDLE(Path);

now I declared in m< main program

    TD1 outputCluster;
    Path basePath;

and run

    ReadSetupFile(&basePath, &outputCluster);

outputCluster is a structure easy to read and to write but I have problems with the LavView variable "basePath"

The solution of Path is

typedef Path_t ** Path

All trials like

    basePath = "C:\blabla";
    *basePath = "C:\blabla";
    **basePath = "C:\blabla";
   basePath.    ...
    *basePath.    ...
    **basePath.    ...
    basePath->    ...
    *basePath->    ...
    **basePath->    ...

are not running.

How can I handle this?

Regards

Jens


Path is a LabVIEW datatype and only LabVIEW itself knows really how to deal with this. It is basically a LabVIEW handle with a private data structure. Private meaning LabVIEW does not really document its memory layout. You deal with Path variables in C code by calling into the LabVIEW manager functions as documented in the External Code Reference Manual.

Please note that making use of LabVIEW manager functions in your DLL will make that DLL depending on the LabVIEW runtime engine and therefore limit the use of the DLL to be used inside LabVIEW or built LabVIEW applications. If that is no issue for you you simply include extcode.h from LabVIEW in your source code file and link the resulting DLL project with labview.lib. If this is a problem for you not using the Path or any other LabVIEW specific datatype that uses LabVIEW data handles is the only solution.

You can for instance pass the path as a C string instead to your DLL.

Rolf Kalbemratter
Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 2 of 2
(2,615 Views)