LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

integrating C++ in LabVIEW

Hi
 
I have written DLL for a for loop,imported in LabVIEW aswell but the program is not running(not counting) in LabVIEW
 
 
0 Kudos
Message 1 of 4
(2,936 Views)
Could provide a little more information? This isn't enough data to even begin making a guess. What are you trying to do? Development environments? Source code?

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 2 of 4
(2,927 Views)

Thanks Mike

Actually I need to run the counting program in LabVIEW with the source of C++ program(imported into LabVIEW as dll)

C++ program is compiling successfully,the code

#include "stdafx.h"
#include <iostream.h>
#include <windows.h>
#include <conio.h>

BOOL APIENTRY DllMain( HANDLE hModule,
                       DWORD  ul_reason_for_call,
                       LPVOID lpReserved
      )
{
    return TRUE;
}

_declspec (dllexport) int a (int counter)

{
  for (counter=1;
        counter<=1000;
     counter++)
  return counter;
     }

Thanks

Veera

 

0 Kudos
Message 3 of 4
(2,895 Views)
I think you have a bug in your C++ code.

You have the return clause inside the body of the loop which means that the loop does not do anything, it just returns the value of counter which is 1.

I guess you want something like this

_declspec (dllexport) int a (int counter)

{
  for (counter=1; counter<=1000; counter++)

     counter ++

  return counter;
}

By the way, why are you passing the counter as a parameter if it is given a value of 1 in any case?
0 Kudos
Message 4 of 4
(2,871 Views)