取消
显示结果 
搜索替代 
您的意思是: 

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 项奖励
1 条消息(共 3 条)
2,745 次查看
0 项奖励
2 条消息(共 3 条)
2,737 次查看

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

 

Ken

0 项奖励
3 条消息(共 3 条)
2,728 次查看