public inbox for gsl-discuss@sourceware.org
 help / color / mirror / Atom feed
* Borland C++ gsl_rng
@ 2004-05-17 21:09 Michał Strug
  2004-05-18  8:29 ` Joakim Hove
  0 siblings, 1 reply; 3+ messages in thread
From: Michał Strug @ 2004-05-17 21:09 UTC (permalink / raw)
  To: gsl-discuss

Hello

    I'm trying to use GSL in Borland C++ Compiler 5.5 (w2k). I've got 
every libs. I tried to compile simple program which use gsl/gsl_rng.h. 
And during compilation I've got message (other function such as 
gsl_rng_env_setup were consolidated without problems):
Error: Unresolved external '_gsl_rng_default' referenced from 
C:\PROGRAMY\BCC55\PROGS\GSL\PROG.OBJ

compiling commands:
bcc32 -ps -c prog.cpp
ilink32 -ap prog.obj c0x32,,,cw32 import32 libgsl libgslcblas

libgsl.lib libgslcblas.lib I've maked from libgsl.dll and 
libgslcblas.dll using implib.exe

program code:
#include <stdio.h>
#include <iostream.h>
#include <gsl/gsl_rng.h>
int main (void) {
  const gsl_rng_type * T;
  gsl_rng * r;
  int i, n = 10;
  gsl_rng_env_setup();
  T = gsl_rng_default;
  r = gsl_rng_alloc (T);
  for (i = 0; i < n; i++)    {
      double u = gsl_rng_uniform (r);
      printf ("%.5f\n", u);    }
  gsl_rng_free (r);
  return 0; }

    Michal

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Borland C++ gsl_rng
  2004-05-17 21:09 Borland C++ gsl_rng Michał Strug
@ 2004-05-18  8:29 ` Joakim Hove
  0 siblings, 0 replies; 3+ messages in thread
From: Joakim Hove @ 2004-05-18  8:29 UTC (permalink / raw)
  To: gsl-discuss

Michał Strug <mbr4@o2.pl> writes:




>   const gsl_rng_type * T;
>   gsl_rng * r;
>   gsl_rng_env_setup();
>   T = gsl_rng_default;
>   r = gsl_rng_alloc (T);


Replace with (for instance):

    gsl_rng * r = gsl_rng_alloc (gsl_rng_taus);

I would try allocating one of the rng_types explicitly, like the
gsl_rng_taus generator above. The default method is based on
environment variables - I have no idea how that works from Windows.


HTH - Joakim


-- 
  /--------------------------------------------------------------------\
 / Joakim Hove  / hove@bccs.no  /  (55 5) 84076       |                 \
 | Unifob AS, Avdeling for Beregningsvitenskap (BCCS) | Stabburveien 18 |
 | CMU                                                | 5231 Paradis    |
 \ Thormøhlensgt.55, 5020 Bergen.                     | 55 91 28 18     /
  \--------------------------------------------------------------------/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Borland C++ gsl_rng
@ 2004-05-18 10:02 Michał Strug
  0 siblings, 0 replies; 3+ messages in thread
From: Michał Strug @ 2004-05-18 10:02 UTC (permalink / raw)
  To: gsl-discuss

Hi

    It gives the same message:

Error: Unresolved external '_gsl_rng_taus' referenced from 
C:\PROGRAMY\BCC55\PROGS\GSLNEW\PROG.OBJ

    I think that, maybe this error is caused by importing types from dll 
in borland compiler. All gsl function are exported as stdcall so when 
I'm compiling I'm using -ps switch but how tell to compiler that types 
gsl_rng_taus and gsl_rng_default are too in stdcall convention? Maybe I 
should declare them in borland?

Compiling without -ps switch:
Error: Unresolved external '_gsl_rng_taus' referenced from 
C:\PROGRAMY\BCC55\PROGS\GSLNEW\PROG.OBJ
Error: Unresolved external '_gsl_rng_alloc' referenced from 
C:\PROGRAMY\BCC55\PROGS\GSLNEW\PROG.OBJ
Error: Unresolved external '_gsl_rng_uniform' referenced from 
C:\PROGRAMY\BCC55\PROGS\GSLNEW\PROG.OBJ
Error: Unresolved external '_gsl_rng_free' referenced from 
C:\PROGRAMY\BCC55\PROGS\GSLNEW\PROG.OBJ

    Michal

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-05-18 10:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-17 21:09 Borland C++ gsl_rng Michał Strug
2004-05-18  8:29 ` Joakim Hove
2004-05-18 10:02 Michał Strug

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).