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

Home » Public Forums » archive » Re: Do I need a DLM Wrapper for this?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Do I need a DLM Wrapper for this? [message #37303] Wed, 10 December 2003 22:46
Brian is currently offline  Brian
Messages: 27
Registered: March 2001
Junior Member
Thanks! I will be checking out that book.

-brian

"Rick Towler" <rtowler@u.washington.edu> schrieb im Newsbeitrag
news:br7m89$g96$1@nntp6.u.washington.edu...
>
> "Brian" wrote in message...
>
>> I am somewhat new to IDL, so you can imagine how confusing I find the
> notion
>> of DLM wrappers...
>>
>> In any case, I have made several posts about the FFTW3 dll, and I am
> getting
>> closer to being able to get it working, but now I have come across DLMs,
> and
>> am wondering if I need one (and in general wondering under which
>> circumstances I need one).
>
> From what I see it looks like you will need to write a .dlm. I don't use
> CALL_EXTERNAL but it looks like it can only return scalar simple types
(and
> strings) and I am guessing that fftw_plan is a structure? To complicate
> matters, I don't see how you would actually get "out" into IDL since
you'll
> only see a pointer on the IDL side.
>
> First thing I would do is contact Dick French. He posted in your previous
> thread about FFTW and using it with IDL. I don't think he has built for
> windows but usually these C .dlms port like butta (except on MacOS X it
> seems). A number of us in this group can help you modify the makefile for
> windows if needed.
>
> The second thing I would do is get Ronn Kling's book "Calling C from
IDL..."
> available from www.kilvarock.com. This is a must have if you want to
write
> .dlms for IDL.
>
> Good luck.
>
> -Rick
>
>
Re: Do I need a DLM Wrapper for this? [message #37312 is a reply to message #37303] Wed, 10 December 2003 11:59 Go to previous message
b_gom is currently offline  b_gom
Messages: 105
Registered: April 2003
Senior Member
Brian,

IF you mean 'can I do this with CALL_EXTERNAL', then the answer is
yes; you don't really need a DLM. DLMs are much more convenient,
however, once you get used to the syntax. In general, I think you want
a DLM when you need access to IDL internals, and you want your code to
be called as if it were a built-in IDL function. It's also easier to
get data types and memory screwed up when using CALL_EXTERNAL.

I've posted a sample of how you can do this with a DLM at:
http://people.uleth.ca/~brad.gom/fftw/
You'll need to unzip the VC++ project and the FFTW library into
c:\fftw. If you don't have VC++, then you should be able to figure out
the code from fftw_dlm.c
The code only calls the real, 1-D FFT, but it should be clear how to
extend it to the other functions. Note this code is non-polished.

Good luck

Brad

"Brian" <brian.huether@NOdlrSPAM.de> wrote in message news:<42248903bfffbe75ba4af3e74473e176@news.teranews.com>...
> I am somewhat new to IDL, so you can imagine how confusing I find the notion
> of DLM wrappers...
>
> In any case, I have made several posts about the FFTW3 dll, and I am getting
> closer to being able to get it working, but now I have come across DLMs, and
> am wondering if I need one (and in general wondering under which
> circumstances I need one).
>
> Do I need to write a DLM wrapper to truly use this fftw3 dll? In the manual
> it says
>
> The basic usage of FFTW to compute a one-dimensional DFT of size N is
> simple, and it
> typically looks something like this code:
> #include <fftw3.h>
> ...
> {
> fftw_complex *in, *out;
> fftw_plan p;
> ...
> in = fftw_malloc(sizeof(fftw_complex) * N);
> out = fftw_malloc(sizeof(fftw_complex) * N);
> p = fftw_plan_dft_1d(N, in, out, FFTW_FORWARD, FFTW_ESTIMATE);
> ...
> fftw_execute(p); /* repeat as needed */
> ...
> fftw_destroy_plan(p);
> fftw_free(in); fftw_free(out);
> }
> (When you compile, you must also link with the fftw3 library,
> e.g. -lfftw3 -lm on
> Unix systems.)
> First you allocate the input and output arrays. You can allocate them in any
> way that
> you like, but we recommend using fftw_malloc, which behaves like malloc
> except that it
> properly aligns the array when SIMD instructions (such as SSE and Altivec)
> are available
> (see Section 3.1.1 [SIMD alignment and
> tw malloc], page 15).
>
> I am just confused how I pass an array in IDL to this dll.
>
> -brian
Re: Do I need a DLM Wrapper for this? [message #37315 is a reply to message #37312] Wed, 10 December 2003 09:45 Go to previous message
Rick Towler is currently offline  Rick Towler
Messages: 821
Registered: August 1998
Senior Member
"Brian" wrote in message...

> I am somewhat new to IDL, so you can imagine how confusing I find the
notion
> of DLM wrappers...
>
> In any case, I have made several posts about the FFTW3 dll, and I am
getting
> closer to being able to get it working, but now I have come across DLMs,
and
> am wondering if I need one (and in general wondering under which
> circumstances I need one).

From what I see it looks like you will need to write a .dlm. I don't use
CALL_EXTERNAL but it looks like it can only return scalar simple types (and
strings) and I am guessing that fftw_plan is a structure? To complicate
matters, I don't see how you would actually get "out" into IDL since you'll
only see a pointer on the IDL side.

First thing I would do is contact Dick French. He posted in your previous
thread about FFTW and using it with IDL. I don't think he has built for
windows but usually these C .dlms port like butta (except on MacOS X it
seems). A number of us in this group can help you modify the makefile for
windows if needed.

The second thing I would do is get Ronn Kling's book "Calling C from IDL..."
available from www.kilvarock.com. This is a must have if you want to write
.dlms for IDL.

Good luck.

-Rick
Re: Do I need a DLM Wrapper for this? [message #37317 is a reply to message #37315] Wed, 10 December 2003 08:37 Go to previous message
Karl Schultz is currently offline  Karl Schultz
Messages: 341
Registered: October 1999
Senior Member
"Brian" <brian.huether@NOdlrSPAM.de> wrote in message
news:42248903bfffbe75ba4af3e74473e176@news.teranews.com...
> I am somewhat new to IDL, so you can imagine how confusing I find the
notion
> of DLM wrappers...
>
> In any case, I have made several posts about the FFTW3 dll, and I am
getting
> closer to being able to get it working, but now I have come across DLMs,
and
> am wondering if I need one (and in general wondering under which
> circumstances I need one).
>
> Do I need to write a DLM wrapper to truly use this fftw3 dll? In the
manual
> it says
>
> The basic usage of FFTW to compute a one-dimensional DFT of size N is
> simple, and it
> typically looks something like this code:
> #include <fftw3.h>
> ...
> {
> fftw_complex *in, *out;
> fftw_plan p;
> ...
> in = fftw_malloc(sizeof(fftw_complex) * N);
> out = fftw_malloc(sizeof(fftw_complex) * N);
> p = fftw_plan_dft_1d(N, in, out, FFTW_FORWARD, FFTW_ESTIMATE);
> ...
> fftw_execute(p); /* repeat as needed */
> ...
> fftw_destroy_plan(p);
> fftw_free(in); fftw_free(out);
> }
> (When you compile, you must also link with the fftw3 library,
> e.g. -lfftw3 -lm on
> Unix systems.)
> First you allocate the input and output arrays. You can allocate them in
any
> way that
> you like, but we recommend using fftw_malloc, which behaves like malloc
> except that it
> properly aligns the array when SIMD instructions (such as SSE and Altivec)
> are available
> (see Section 3.1.1 [SIMD alignment and
> tw malloc], page 15).
>
> I am just confused how I pass an array in IDL to this dll.
>
> -brian

You should really look into AUTO_GLUE. Start with the CALL_EXTERNAL
documentation and find the discussion on auto glue.

The reasons *why* you need auto glue, and why you just can't pass IDL
variables to C entry points, is also described there as well as in the
general external development documentation.

That being said, I'm not sure that you'll be able to get away with just auto
glue, especially if you have to use a special malloc and pass around "plan"
data structures. But you can certainly call and use this lib with a
hand-coded DLM.

Karl
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Resolving Built-ins and FORWARD_FUNCTION
Next Topic: EOS_SW source codes

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

Current Time: Wed Oct 08 13:56:30 PDT 2025

Total time taken to generate the page: 0.00510 seconds