LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

visual studio 2010 dll (c++)

Solved!
Go to solution
Highlighted

Hi everyone,

 

Here is my problem. I'd like to build a c++ dll with visual studio 2010 sp1 to be called by a vi in labview real time 2015 (9081 target with visual studio 2010 run time engine).

I downloaded the example provided by NI at this adress: http://www.ni.com/example/26480/en/

The example works fine but the dll was built in vc++ 06.

I tried to open the project, correct the error and rebuild a solution (both debug and release), but the new dll does not work under RT target.

Since I'm quite noob in c++ i guess the error come from my build but I can't find the error(s).

Here are my vc++ project and the dll i built (debug)

 

Thanx for you help

0 Kudos
Message 1 of 7
(2,214 Views)
Highlighted

I once had to do a few things with Visual Studio, and I was so happy to return to LabVIEW, where all the dirty details are handled by Developers Who Know (most of the time) What They Are Doing.  My sympathies ...

 

Bob Schor

0 Kudos
Message 2 of 7
(2,211 Views)
Highlighted

Visual Studio 2010 is internally at version 10.0 of the Microsoft Visual C runtime. That means if you create a DLL that uses the Microsoft Visual C runtime library (and it's basically impossible to not do that even if you do not explicitedly call any C runtime functions), then you will need to have the according Runtime installed on every possible target.

 

Can you show us a screen shot of your software installation for that controller in NI MAX?

 

Also the Debug version of a DLL links to a completely different version of the C runtime library that nobody but Microsoft is allowed to redistribute and you only can get that installed on a system by installing the Visual Studio Development system. There is no way to get Visual Studio installed on the Pharlap ETS OS used for the NI Realtime targets. So you have to build the Release version of the DLL and use that on the Realtime target.

Rolf Kalbermatter
Averna BV
0 Kudos
Message 3 of 7
(2,185 Views)
Highlighted

Hi,

Thanx for answearing

Here is my cRIO config

Also, I tried to build myself a dll with visual studio 2010 following this example http://www.ni.com/white-paper/3056/en/

It worked (and Yes I needed to use build with release).

I now try to add a callback function but seems I did not implemant this function properly (see y code attached)

Thank you

Download All
0 Kudos
Message 4 of 7
(2,176 Views)
Highlighted

Since you seem to be able to get a DLL working that you made with your VC compiler, the problem would have to be specific to your use of the PostLVEvent function. However you do not explain what is not working nor what sort of error you get. 

Rolf Kalbermatter
Averna BV
0 Kudos
Message 5 of 7
(2,152 Views)
Highlighted
Solution
Accepted by Guillaume.Cl

Hi,

Thx for answearing.

I found the solution to my problem.

Since teh Dll is working it was effectively a compilation pb due to my project propertie.

Thank you for your support.

Btw, I am right assuming that on my cRIO target I won't be able to run my DLL if I compile it in Visual studio 2015?

Thank you

0 Kudos
Message 6 of 7
(2,145 Views)
Highlighted

@Guillaume.Cl wrote:

 

 

Btw, I am right assuming that on my cRIO target I won't be able to run my DLL if I compile it in Visual studio 2015?


Well, NI provides for their Pharlap ETS sytems C runtime libraries for MSVC 7.1, MSVC 9, and MSVC 10, which corresponds to VS 2003 .Net, VS 2008 and VS 2010 respectively. I haven't seen any newer runtimes and it is very unlikely they will add them, since almost all the Pharlap ETS based RT targets are now in pure maintenance mode, and any new targets are released with the NI Linux RT OS.

 

It's possible to compile a DLL and include the C runtime by specifying that in the project settings. However the newer C runtimes also tend to call newer Windows OS APIs at some point that the Pharlap ETS system never provided. Basically the Pharlap ETS system provides a subset of the Windows API as it was implemented by Windows 2000. Anything that has been added by Microsoft to Windows since then is almost certainly not supported by the Pharlap ETS system. And Microsoft usually makes sure to use new Windows APIs in their C runtime library and the startup initialization stub that gets added to every DLL and executable.

Rolf Kalbermatter
Averna BV
0 Kudos
Message 7 of 7
(2,142 Views)