LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

GNU Scientific Library (GSL)

Hi,

 

I am trying to use some of SGL functions for machine learning project within Labwindows/CVI 2015. I ran gsl-1.8.exe to install the required files. when I include the libgsl.a in my CVI project, I get link error.

 

Build Status (XML-ML.prj - Debug)
Link XML-ML.exe
error: Undefined symbol '_gsl_fit_linear_est' referenced in "c:\cvibuild.XML-ML\Debug\CS-XML-ML.obj".
error: Undefined symbol '_gsl_fit_wlinear' referenced in "c:\cvibuild.XML-ML\Debug\CS-XML-ML.obj".
Build failed 

 

 

I appreciate the help. Thank you.

0 Kudos
Message 1 of 4
(2,562 Views)

I myself found a turn-around solution by using LoadLibrary to load libgsl.DLL, and not .lib files (libgsl.a)

Message 2 of 4
(2,539 Views)

Hi, I am trying to do the same but have not been successful. Can you please suggest what you did?

 

#include <cvirte.h>
#include <userint.h>
#include "GSLTest.h"
#include <stdio.h>
#include <windows.h>
 
typedef double (*MYPROC)(double);
 
static int panelHandle;
 
HINSTANCE hinstLib, hinstLib_1; //Handle to the DLL
MYPROC ProcAddress; //Pointer to the function
 
int main (int argc, char *argv[])
{
if (InitCVIRTE (0, argv, 0) == 0)
return -1; /* out of memory */
if ((panelHandle = LoadPanel (0, "GSLTest.uir", PANEL)) < 0)
return -1;
DisplayPanel (panelHandle);
RunUserInterface ();
DiscardPanel (panelHandle);
return 0;
}
 
int CVICALLBACK panelfunc (int panel, int event, void *callbackData,
   int eventData1, int eventData2)
{
switch (event)
{
case EVENT_GOT_FOCUS:
 
break;
case EVENT_LOST_FOCUS:
 
break;
case EVENT_CLOSE:
 
 
hinstLib = LoadLibrary("C:\Program Files (x86)\GnuWin32\bin\libgsl.dll");
 
ProcAddress = (MYPROC) GetProcAddress(hinstLib, "gsl_sf_bessel_J0");
 
double returnValue = (ProcAddress)(5.0);
 
printf("%lf",returnValue);
 
QuitUserInterface (0);
break;
}
return 0;
}

 

0 Kudos
Message 3 of 4
(679 Views)

Can you elaborate what "I have been not successful" really means?

Does it crash? REeturn a wrong result? Or you don't really know as you are trying to figure out where to see any possible result?

 

First thing is that you most likely do not really want to load and call that function when you close the panel?

 

Next question is if you set the default calling convention for functions in your CVI project to anything else than __cdecl (only relevant for 32-bit, in 64-bit it is always __fastcall anyways)?

Even Microsoft Visual C uses that as default calling convention.

 

And the GSL library being GNU, it seems very unlikely that it would use __stdcall under Windows.

 

 

Rolf Kalbermatter
My Blog
0 Kudos
Message 4 of 4
(611 Views)