help-gsl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-gsl] Hello All, didn't find any tips for BorlandC++ Builder v6 and


From: Denis Glehen
Subject: [Help-gsl] Hello All, didn't find any tips for BorlandC++ Builder v6 and GSL lib
Date: Mon, 7 Dec 2009 21:12:38 +0100

Hello,

I hope I will not boring everyone with my question but I'm trying to use GSL
with Borland C++ Builder v6.
I saw on this mailing list some tips for this and I've done this :

A) downloading the last GSL v1.13 source and windows binaries (
http://ascendwiki.cheme.cmu.edu/Binary_installer_for_GSL-1.13_on_MinGW)


B) change the include [gsl_types.h]

#ifndef GSL_VAR
   #if defined(__BORLANDC__) || defined(__BCPLUSPLUS__)
   /* We have a Borland compiler
    It has __WIN32__ instead of WIN32 in MSVC,
    __DLL__ instead of _DLL in MSVC
   also add extern to the macro
   */
   #  ifdef __WIN32__
      #    ifdef __DLL__
         #      define GSL_VAR extern __declspec(dllexport)
      #    else
         #      define GSL_VAR extern __declspec(dllimport)
      #    endif
   #  else
      #    define GSL_VAR extern
   #  endif
#else

/* normal procedure
*/
etc...


C) translate from the DLL to get a compatible C++Builder .LIB by

implib -a -c libgsl-0.lib libgsl-0.dll
implib -a -c libgslcblas-0.lib libgslcblas-0.dll

(don't know why there is a -0.. but why not)


D) create on the Builder IDE a small window with a TMemo // memoData //
just to write a test result and use when opening the form the following code
:


#include <vcl.h>
#pragma hdrstop

#include "main.h"

#define WIN32 __WIN32__

#include <gsl/gsl_types.h>
#include <gsl/gsl_blas.h>

//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
   : TForm(Owner)
{
   AnsiString string;

  double a[] = { 0.11, 0.12, 0.13,
                 0.21, 0.22, 0.23 };

  double b[] = { 1011, 1012,
                 1021, 1022,
                 1031, 1032 };

  double c[] = { 0.00, 0.00,
                 0.00, 0.00 };

  gsl_matrix_view A = gsl_matrix_view_array(a, 2, 3);
  gsl_matrix_view B = gsl_matrix_view_array(b, 3, 2);
  gsl_matrix_view C = gsl_matrix_view_array(c, 2, 2);

  /* Compute C = A B */

  gsl_blas_dgemm (CblasNoTrans, CblasNoTrans,
                  1.0, &A.matrix, &B.matrix,
                  0.0, &C.matrix);

   string.sprintf("[ %g, %g\n", c[0], c[1]);
   memoData->Lines->Add(string);
   string.sprintf("  %g, %g ]\n", c[2], c[3]);
   memoData->Lines->Add(string);
}


sorry for this, this is standard builder code :-s

E) compile and link with
libgsl-0.lib
libgslcblas-0.lib

all is ok for compiling and linking (no Error)

D) execute and... surprise .. :-s it doesn't work !

when executing, an error window appear with a

RunTime Error !
this application has requested the Runtime to terminate .. etc... etc...





So, it seem that it's not so simple to use gsl on other system than gcc
(maybe QT ? have to check)
The case is that I use to develop my softs on C++Builder v6 so. If someone
should have tips and tricks
to get someting working (or place to find the good static lib (without using
dll) I will thank him (or her) a lot.

Do you have any ideas ?

Best for all

-- 
Denis Glehen


reply via email to

[Prev in Thread] Current Thread [Next in Thread]