Recent

Author Topic: GSL library in Lararus  (Read 7832 times)

JpAustralia

  • Newbie
  • Posts: 3
GSL library in Lararus
« on: December 16, 2010, 10:13:19 am »
Hi,

for my master degree thesis i am developing a program in Lararus. I need to use some functions of the gsl libraries, but I don't known how to use external libraries at all. Someone can help me?
I know only that i must include the header file of the libraries and modify the linker option. I am working on win xp, an i have a version of gsl 1.14 compiled for windows, in particular i have
in
\gsl-1.14\gsl-1.14-vc10\build.vc10\lib\Win32\Debug

a file gsl.lib
which i think is a static library.
 
I need a simple explanation, because i am a basic user, i am in the word of object programming and visual programming since 3 months, before i have used only matlab for all my stuff.

Thanks

Alessio

Laksen

  • Hero Member
  • *****
  • Posts: 658
    • J-Software
Re: GSL library in Lararus
« Reply #1 on: December 16, 2010, 12:24:12 pm »
It would probably be easier to link to a dll on Windows. Otherwise try -lgsl and -Fl\gsl-1.14\gsl-1.14-vc10\build.vc10\lib\Win32\Debug

Otherwise, what kind of functionality do you need from that library?

JpAustralia

  • Newbie
  • Posts: 3
Re: GSL library in Lararus
« Reply #2 on: December 16, 2010, 01:30:56 pm »
Hi Laksen, first of all thanks to have replayed to my post. Hence, I have tried, but lazarus gives to me an error: . I have do this:

Project->Compiler Options  and then in tab path, in

Include file(-FI):
$(ProjOutDir)\-gsl\

and in Library (-FI):
C:\gsl-1.14\gsl-1.14-vc10\build.vc10\lib\Win32\Debug\

and then i have declared the function gsl_linalg_LU_decomp that is what i need to use.

In  \gsl-1.14\gsl-1.14-vc10\build.vc10, I have found  a dll

gsl.dll

but it is also 40.kb.

If i want to link a dll what i have to do in this case?

I am sorry, but this the first time that i try to use an external library.

Thanks

Alessio



in this case what i have to do?

Thank you,

Laksen

  • Hero Member
  • *****
  • Posts: 658
    • J-Software
Re: GSL library in Lararus
« Reply #3 on: December 16, 2010, 05:10:01 pm »
To dynamically link to a dll, you don't have to give any compiler options

Simply convert the c function to a pascal function as usual:
on
Something like:
int gsl_linalg_LU_decomp (gsl_matrix * A, gsl_permutation * p, int * signum)
function gsl_alglib_lu_decomp(A: Pgsl_matrix; p: Pgsl_permutation; signum: pinteger): longint; cdecl; external 'gsl.dll' name 'gsl_linalg_LU_decomp';

JpAustralia

  • Newbie
  • Posts: 3
Re: GSL library in Lararus
« Reply #4 on: December 17, 2010, 12:44:50 pm »
I have tried with the dll, but I continue to have some problems:
Lazarus-Free pascal compile and link, it, as usually, says to me

Project sucessifully built

but when the application should be appear, an error message is displayed:

''
Debugger Error:
The debugger entered the error state!
Ooops save your works...ect
''
but I dont'know why.
Thanks

 

TinyPortal © 2005-2018