LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to call DLL file which contain arguments Pointer to a zero terminated c string?

Solved!
Go to solution

Hi to all,

  

  I am trying to call DLL file from LabVIEW. That DLL have many function, some functions working good. There one function is LONG PGSJobStart(DWORD nSlotID, LPCSTR pszJob)  . 

 

Here LONG represented signed int 32 bit, DWORD represent unsigned int 32 bit, LPCSTR represent Pointer to a zero terminated c string ( These all are I collect from DLL manual). 

 

Here I tried to call above mention function  that time my vi crashed. i don't know why this happens . 

 

first I tried other function which is contain only integer arguments that is working fine . 

 

But I try to call this type of function I got crashed msg only. 

 

In LabVIEW I selected for LPCSTR in call library function (configure mode) I selected argument type is string and I tried format first I tried c String pointer the next time I tried with Pascal string format both time my Vi crashed only. 

 

So please explain any one What is the meaning of Pointer to a zero terminated c string and how call from labview.

 

Thanks in advance

 

Arunkumar M

 

0 Kudos
Message 1 of 5
(2,795 Views)

Are you able to share the DLL, or one similar?

 

I'd want to play around a bit to see if I could get it to call without a crash.  But, I'd be making guesses without a DLL with that type.

0 Kudos
Message 2 of 5
(2,739 Views)
Solution
Accepted by topic author arun575

The parameter configured to be String, passed as a C string pointer should be right. And you need of course to provide a meaningfull string that the function can interpret. If this crashes you have something else wrong. It could be the calling convention, or you are not selecting the function that your prototype describes.

Rolf Kalbermatter
My Blog
0 Kudos
Message 3 of 5
(2,730 Views)

hi natasftw, sorry I don't have full DLL program . I have only function name and return type (and what are the arguments inside ). this statement only i got from manual .

 

And Averna BV  now resolve the problem . Actually last time I had selected or declare erratic arguments details .That is the reason that crashes happens, now I studied detailed and fix the problem now it is working good.

 

And one more question I need declare of DLL function's one of the Argument is 1D string array . 

It is possible if possible how I can declare or else give some succession 

 

Thanks 

Regards

Arunkumar 

0 Kudos
Message 4 of 5
(2,696 Views)

No there is no simple configuration option to do that. LabVIEW strings are not C strings in several ways, so if you pass an array of strings to the function it will surely cause error 1097 or simply crash right away. There have been many posts in the past about this. Some answered by Nathan and some by me.

Nathan showed a few times how to do it in the LabVIEW diagram. I for myself prefer to write a wrapper DLL in C which converts properly between the LabVIEW datatype and the C datatype required by the DLL.

Rolf Kalbermatter
My Blog
0 Kudos
Message 5 of 5
(2,689 Views)