10-14-2010 11:30 AM
I am setting out to combine external C code with LabVIEW code for the first time. The example, "Call DLL" is quite helpful, and it generated some helpful C. code which I include at the bottom of this message. But now I need to know how to build it, to make the DLL. I would like to use GCC, because it is free, but I have no experience with using GCC to build DLLs. And I don't know what special flags may need to be set to make the DLL appropriate for LabVIEW. Does anybody out there have a makefile, a .BAT script, or any other helpful examples on how to do this build?
Thanks,
Ken
-----------------------------------------
#include "extcode.h"
/* LabVIEW created typedef */
typedef struct {
int32 dimSizes[2];
double elt[1];
} TD1;
typedef TD1 **TD1Hdl;
_declspec(dllexport) void ARRAY2DHandle(TD1Hdl array);
_declspec(dllexport) void ARRAY2DHandle(TD1Hdl array)
{
int i, j;
/* dimSizes[0] is the number of rows */
int numrow = (*array)->dimSizes[0];
/* dimSizes[1] is the number of columns */
int numcol = (*array)->dimSizes[1];
for(i = 0; i < numrow; i++)
{
for(j = 0; j < numcol; j++)
{
(*array)->elt[(i * numcol) + j] = (*array)->elt[(i * numcol) + j] *
(*array)->elt[(i * numcol) + j];
}
}
}
10-14-2010 12:18 PM
10-14-2010 01:29 PM
Sorry. Server error. It told me the post had failed when it hadn't!
Ken