06-17-2015 08:51 AM
Hello to all readers of my post.
The extcode.h file I have here contains a function called PStrToDSLStr. When I tried to use it I get the error messag, that PStrToDSLStr is not contained in lvrt.dll. In which DLL will i find PStrToDSLStr?
Background: I am using c# to connect a device. The interface to the device was created by LabView.
Thank you
06-24-2015 06:43 AM
Hello! Any progress on this post?
Have you also included toolbox.h?
i'm not sure what the function PStrToDSLStr does. Can you comment it out and compile?
do you have the LabVIEW Runtime installed? / in which folder is lvrt.dll located?
do you already know this example: http://www.ni.com/example/26515/en/
06-24-2015 09:54 AM
@mmadl wrote:
Hello! Any progress on this post?
Hello mmadl, thank you for asking - no progress.
Have you also included toolbox.h?
no such file on my computer.
i'm not sure what the function PStrToDSLStr does. Can you comment it out and compile?
do you have the LabVIEW Runtime installed? / in which folder is lvrt.dll located?
out of extcode.h:
First there is a definition of UHandle, PStr and LStrHandle:
@/** @brief Basic unsigned character pointer and handle types. */
typedef uChar *UPtr, **UHandle;
@/** @brief Pascal-style string types. 1-byte length followed by data. */
typedef uChar *PStr, **PStrHandle;
/* Long Pascal-style string types. */
typedef struct {
int32 cnt; /* number of bytes that follow */
uChar str[1]; /* cnt bytes */
} LStr, *LStrPtr, **LStrHandle;
Second there is a function to allocate memory
/*** The Memory Manager ***/
/*
For parameters to the memory manager functions below
p means pointer
h means handle
ph means pointer to handle
*/
TH_REENTRANT EXTERNC UHandle _FUNCC DSNewHandle(size_t);
TH_REENTRANT EXTERNC UHandle _FUNCC DSNewHClr(size_t);
this function DSNewHClr() I find in lvrt.dll, which is located at C:\Program Files (x86)\National Instruments\Shared\LabVIEW Run-Time\2014
DSNewHClr() creates a Handle to memory allocated inside the memory manager.
In my example it contains a string.
To copy my string to this reserved memory I should use
/*** Long Pascal-Style String Support Functions ***/
TH_REENTRANT EXTERNC MgErr _FUNCC PStrToDSLStr(PStr buf, LStrHandle *lStr);
PStrToDSLStr() is not found in lvrt.dll. Where can I find it?
do you already know this example: http://www.ni.com/example/26515/en/
this example seems to be for C++, I am using C#:
Microsoft Visual Studio 2008
Version 9.0.21022.8 RTM
Microsoft .NET Framework
Version 3.5 SP1
Installierte Edition: C# Express
Microsoft Visual C# 2008 91910-152-0000061-60010
Microsoft Visual C# 2008
so the main question remains: which LV-DLL contains
TH_REENTRANT EXTERNC MgErr _FUNCC PStrToDSLStr(PStr buf, LStrHandle *lStr);
alternatively: which function can I use to pass my string to memory manager managed allocations?
06-24-2015 11:20 AM
In extcode.h on my machine (LabVIEW 2012), PStrToDSLStr is marked as deprecated; if you're using a newer version, I assume it's also deprecated there. So you should not be using that function. What are you actually trying to do? If you're using C#, why not build a .NET assembly instead? It will be much simpler to deal with passing data to and from LabVIEW, and you won't have to worry about the low-level details of strings. If you must build this as a DLL, please share your code (both LabVIEW and C#) and explain exactly what you want to do.