LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

c code extcode error

hey, all

 

i got a problem whit a smal program that fetches blobs from a table in a mySQL database, and pasing them on to labview. the problem is that i get an error whit the Extcode.h and the fundtype.h header files. and i dont know what to make of them.

 

here is my code:

__________________________________________________________________________________________________

/* Call Library source file */

#include "my_global.h"

#include "extcode.h"

#include "mysql.h"


#define MYEXPORT __declspec(dllexport)

 

MYEXPORT int32_t myDLLfunction(MYSQL_ROW row, int64_t iddatalog, int64_t station, CStr vanafdatum);

MYEXPORT int32_t openDatabaseConnection(void);

MYEXPORT int32_t closeDatabaseConnection(void);//#ifdef __cplusplus//}//#endif


MYSQL *conn; 

MYSQL_RES *result;   

int num_fields; 

int i;


int32_t myDLLfunction(MYSQL_ROW row, int64_t iddatalog, int64_t station, CStr vanafdatum)

char s[100];  sprintf(s,"SELECT blbData, iddatalog FROM vwdatareceived WHERE iddatalog > %d AND dtmClientStamp > %s AND idStation = %d", iddatalog, vanafdatum, station);  mysql_query(conn,s);  result = mysql_store_result(conn);
 num_fields = mysql_num_fields(result);


  while ((row = mysql_fetch_row(result))) 

{     

for(i = 0; i < num_fields; i++)     

{       

  printf("%s ", row[i] ? row[i] : "NULL");   

printf("\n"); 

}
  mysql_free_result(result);

}

 

int32_t openDatabaseConnection()

{

conn = mysql_init(NULL);mysql_real_connect(conn, "192.168.1.231", "ptsdataviewer", "", "pts", 0, NULL, 0);

}

int32_t closeDatabaseConnection()

{

mysql_free_result(result);

mysql_close(conn);

}

 ________________________________________________________________________________________________________

if i try to compile it i get the following errors:

-->1>c:\program files\national instruments\labview 2010\cintools\fundtypes.h(165): warning C4142: benignredefinition of type

 

--> 1>c:\program files\national instruments\labview 2010\cintools\extcode.h(814): error C2040: 'File' : 'File_t *' differs in levels of indirection from 'int'

 

i hope anyonce can help me whit this

0 Kudos
Message 1 of 6
(2,614 Views)

Seems you get name definition clashes between your definitions in my_globals.h or one of its imported headers and declarations in extcode.h. Solution is really only one: Resolve thoise conflicts by renaming them in your part of the code. You can't change extcode.h or any of its friends as you have no possibility to change the way LabVIEW expects it's external code to behave.

Rolf Kalbermatter
My Blog
0 Kudos
Message 2 of 6
(2,611 Views)

hey, rolfk.

 

thnx for your quick responce, i took a look at the content of my header files and i noticed that there is an error in my_global.h according microsoft visual c++

in the following segment:

 

C_MODE_START

typedef int(*qsort_cmp)(const void *,const void *);

typedef int(*qsort_cmp2)(void*, const void *,const void *);

C_MODE_END

 

the C_MODE_END gives an error. but i dont know if this is the faulth why my whole program wont compile or not?

0 Kudos
Message 3 of 6
(2,594 Views)

This is not an official Win SDK macro so I can't comment on this. It likely is defined in another header file you include somehow,

Rolf Kalbermatter
My Blog
0 Kudos
Message 4 of 6
(2,590 Views)

thnx for the quick responce.

 

i found out that in my_global.h there is a variable int file and in extcode.h there a variable whit the same name. witch is a pointer. now the problem is me i dont know how to solve this whitout making any changes in the header files themselves. is there an easy solution for this?

 

 

0 Kudos
Message 5 of 6
(2,576 Views)

No! you'll need to make some changes to one of the headers. That said, changing one of the LabVIEW headers is not a good idea! So I think you get the idea.

 

Rolf Kalbermatter
My Blog
0 Kudos
Message 6 of 6
(2,573 Views)