ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

external code gcc makefile

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];
    }
  }
}

0 Kudos
Message 1 of 3
(2,759 Views)
0 Kudos
Message 2 of 3
(2,751 Views)

Sorry.  Server error.  It told me the post had failed when it hadn't!

 

Ken

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