comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Pros & cons of methods 1) DLM and 2) Call_External of calling C from IDL
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Pros & cons of methods 1) DLM and 2) Call_External of calling C from IDL [message #93485 is a reply to message #93483] Tue, 02 August 2016 15:25 Go to previous messageGo to previous message
Michael Galloy is currently offline  Michael Galloy
Messages: 1114
Registered: April 2006
Senior Member
On 8/1/16 1:15 PM, neil.a.salmon@gmail.com wrote:
> Michael,
>
> thanks for your good points and the links. Does either of these
> processes have any impact on the speed with which the C runs called
> from IDL?

I haven't done any tests, but I doubt there is any significant time
difference.

> I'm operating IDL 6.0, so i take it your comments are equally valid
> from this rather old version?

Yes.

> I take it if you have many C routines you'd like to access from IDL
> it would probably best to invest in learning the DLM method?

A lot of the disadvantages of the DLM method are mitigated when doing
many routines. For example, you only write the boilerplate code once,
you only learn the API once, etc. So it is definitely *more* worth it if
there are many routines. But the big difference is whether you want to
use native features like keywords.

By the way, I have some routines in my library to automatically generate
IDL DLM bindings for C routines. You specify the C routines in
header-like format, such as:

void gsl_rng_env_setup();
IDL_PTRINT gsl_rng_alloc(IDL_PTRINT t);
void gsl_rng_free(IDL_PTRINT r);

void gsl_rng_set(IDL_PTRINT r, unsigned long seed);

unsigned long gsl_rng_get(IDL_PTRINT r);
double gsl_rng_uniform(IDL_PTRINT r);
double gsl_rng_uniform_pos(IDL_PTRINT r);
unsigned long gsl_rng_uniform_int(IDL_PTRINT r, unsigned long n);

And my library will output the DLM files. This header is constructed by
hand with a bit of knowledge of the IDL DLM API. The original routine's
prototypes are the following:

const gsl_rng_type * gsl_rng_env_setup (void);
gsl_rng *gsl_rng_alloc (const gsl_rng_type * T);
void gsl_rng_free (gsl_rng * r);

void gsl_rng_set (const gsl_rng * r, unsigned long int seed);

INLINE_DECL unsigned long int gsl_rng_get (const gsl_rng * r);
INLINE_DECL double gsl_rng_uniform (const gsl_rng * r);
INLINE_DECL double gsl_rng_uniform_pos (const gsl_rng * r);
INLINE_DECL unsigned long int gsl_rng_uniform_int (const gsl_rng * r,
unsigned long int n);

Let me know if you are interested. I can point you to the code and some
examples.

Mike
--
Michael Galloy
www.michaelgalloy.com
Modern IDL: A Guide to IDL Programming (http://modernidl.idldev.com)
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: cgcontour and cgcolorbar irregular levels
Next Topic: Code for network analyses

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 17:26:36 PDT 2025

Total time taken to generate the page: 0.00475 seconds