LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

__stdcall and __cdecl

ok this is my c++ project but im calling the DLL in CVI, it works. but the only function that is not doing what i want it to do is void Function(void);

when I call it in CVI , its not print to the screen. do you know why is that ?

 

 

#include <iostream>
#include "DLL_Practice.h"

extern "C"
{
   DECLDIR int Add( int a, int b )
   {
      return( a + b );
   }

   DECLDIR void Function( void )
   {
      std::cout << "DLL Called!" << std::endl;
   }
}

 

 

DLL_Practice.h 

**************************************
#ifndef _DLL_PRACTICE_H_
#define _DLL_PRACTICE_H_
#include <iostream>


#define DECLDIR __declspec(dllexport)


extern "C"
{
   DECLDIR int Add( int a, int b );
   DECLDIR void Function( void );
}

#endif

 

my CVI .c file looks like this of how im calling the various functions i created from the c++ project

 

void Function(void);
int  Add(int a,int b);
int main()
{
    int sum=0;
    Function();
    sum=Add(4,5);
    printf("%d",sum);
    GetKey();
    return 0;
}
 

0 Kudos
Message 1 of 2
(3,394 Views)

can someone tell me why void Function (void) will not print out to the screen when calling it in CVI.

my ADD function works fine, but my 2nd function is not executing.

 

 

extern "C"
{
   DECLDIR int Add( int a, int b )
   {
      return( a + b );
   }

   DECLDIR void Function( void )
   {
      std::cout << "DLL Called!" << std::endl;
   }
}

 

 

0 Kudos
Message 2 of 2
(3,379 Views)