LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

The Select File is not a valid library

I've just been through th chapters 2 and 3 on here...

http://www.ni.com/pdf/manuals/370109a.pdf

 

I've created the myshared.c file (attached)

 

and I've compiled is using

gcc -fPIC -shared -o myshared.dll myshared.c

and there are no errors.

 

However when I try and selet the myshared.dll I am getting a "The file selected is not a valid library"

 

Have I missed something?

 

/* Call Library source file */

#include "extcode.h"

long avg_num(float a[], long size, float *avg);

long avg_num(float a[], long size, float *avg)
{

  int i;
  float sum=0;
  if(a != NULL)
  {
    for(i=0;i < size; i++)
    sum = sum + a[i];
    }
  else
    return (1);
  *avg = sum / size;
  return (0);

}

 

0 Kudos
Message 1 of 7
(3,421 Views)

That is an extremely old and obsolete document. The latest version of that document is actually contained within the LabVIEW Help file. Do you have the Professional edition of LabVIEW, or do you have the Full with the Application Builder? If so, you use that to create a DLL via a project. Please review the updated documentation. Also, forget the bit about CINs. That's obsolete technology.

 

You can also review this: https://decibel.ni.com/content/docs/DOC-15556

0 Kudos
Message 2 of 7
(3,411 Views)

That link seems to document how to turn VI in to DLL.

 

I'm looking to turn .c files in to DLL.

0 Kudos
Message 3 of 7
(3,408 Views)

Sorry, misunderstood what you were trying to do. Still, the document you have is way old and you should review the updated documentation that is in the LabVIEW Help on calling DLLs.

 

Have you tested the DLL by calling it from a C program? What operating system are you using? Which version of gcc? Which version of LabVIEW  (it looks like 2010 or 2011)?  Are you compiling 32-bit or 64-bit? Does your LabVIEW bitness match?

0 Kudos
Message 4 of 7
(3,401 Views)

I'm using Windows 7 x64

Labview 201 x86

and GCC-2.96 on linux.

 

Do i need to include winthe Windows.h file?

0 Kudos
Message 5 of 7
(3,392 Views)

@Richard_Ha wrote:

I'm using Windows 7 x64

Labview 201 x86

and GCC-2.96 on linux.



Umm... hold on. Are you trying to compile a Windows DLL on a Linux machine? Using what, Wine? I'm assuming you are, or you're doing something else. Is there any reason why you don't compile the DLL in Windows directly?

 

And the correct spelling of "Labview" is LabVIEW. We're picky about that around here.

 

 

EDIT: One thought that I had: Are you trying to cross-compile? I'm not sure about gcc, but the little that I've seen in the past regarding cross-compilation seemed to favor mingw over gcc, but I do not know the technical reasons for it, or whether it was just a "flavor of the week".

0 Kudos
Message 6 of 7
(3,379 Views)

I've managed to get the dll file compile in Visual Studio and it working so I will just do that from now on!

 

It has yeielded some interestinf results, but that's for another thread!

 

Thank for the help.

0 Kudos
Message 7 of 7
(3,369 Views)