05-11-2011 10:19 AM
My problem is converting the c++ builder code to the dll...Because some lines (declarations) needs to be added above the code but I couldnt figure out where I need to put those...I think I need to ask a question like how can i make dll with builder to use in labview.
Thanks
05-11-2011 10:28 AM
Make it simpler: Go to a C Builder forum and ask how to create a DLL to be called from other C programs through LoadLibrary() and GetProcAddress().
Most LabVIEW programmers do not create DLLs and those that do use normally Visual C since it mostly just works. So asking here is not likely giving you much detailed feedback.
On the other hand chances that some C Builder users know LabVIEW are pretty minimalistic. So you have to go where C Builder expertise is, namely some C Builder forum, and ask a question they can understand. -> See above first sentence.
05-11-2011 11:49 AM
Try some of these C++ Builder forums as Rolf suggested: http://www.google.com/search?q=C%2B%2B+builder+forum&ie=utf-8&oe=utf-8&aq=t&rls=com.frontmotion:en-U...
05-11-2011 02:05 PM
Thank you friends...
05-11-2011 02:30 PM
I am trying to use a dll in my labview that I created following online steps for a simple code. However, although I can see the function name correct, it does not calculate a value for return. These are pictures for my labview window. Representations are double, display formats are floating and parameters are 8 bit double.
Do you have an idea why the return value is : NaN
Thank you
05-11-2011 02:50 PM
Look in the LabVIEW Example Finder for the Call DLL.vi. It's a good way to learn how to setup conventions and parameters when using a CLFN.
There's also a good manual in LabVIEW Help called "Calling Code Written in Text-based Languages" (in the Fundamentals section).
Also, read this: http://www.ni.com/pdf/manuals/370109a.pdf
BTW, we can't help you very much unless you post your VIs and C++ code so we can look at how you setup your interface node.
05-11-2011 03:06 PM
Thanks NIquist,
I am still reading manual...
Here are the, C++ builder code and my labview... I couldnt attach the dll here....
Thank you....
05-11-2011 04:11 PM - edited 05-11-2011 04:12 PM
Look at the prototype of your CLN setup:
double _BoxProperties(double Length, double Height, double Width);
And the one of your DLL function:
void BoxProperties(double L, double H, double W, double& A)
Forget about the prefixed underscore as that is the default name decoration for cdecl functions. Do you think there is a difference in the number of parameters and or return values??
And if you fix the Call Library Node configuration, make sure to configure the additional 4th parameter to be passed by reference (Pointer to Value).
05-11-2011 05:15 PM
" make sure to configure the additional 4th parameter to be passed by reference (Pointer to Value)."
I didnt understand this. I have 4 parameter one of them is return value, other 3 are inputs. which one is the Additional 4th parameter..Do i need to add one more or change one of those to pointer to value?
Thanks
05-11-2011 05:37 PM
Your DLL function does not return anything (void). Probably (I didn't go through the DLL) it intends to put the results into the memory location pointed to by A. You need to make sure the CLFN parameters match the ones in your DLL or else it will crash, or worse, NOT crash and subtly corrupt memory.