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

Home » Public Forums » archive » Help! pointer address return using idl_tools DLM (EXTPROC_DEFINE)
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
Help! pointer address return using idl_tools DLM (EXTPROC_DEFINE) [message #38476] Thu, 11 March 2004 08:43 Go to next message
andy_capax is currently offline  andy_capax
Messages: 1
Registered: March 2004
Junior Member
Hi

I'm a newbie to Idl. I downloaded the idl_tools DLM library from Ronn
Kling's website http://www.rlkling.com. I"m trying to access from idl
the address of a float pointer returned by a function in C++.
In my C++ program I have:

float* cppfunc(int); //not part of any class


I get the output of the C++ program as sample.dll file using visual
studio 6.0

In Idl I correspondingly use the call:

addr = EXTPROC_DEFINE("idlfunc", "sample.dll", "cppfunc",
"p(i)",/CDECL)
;to get the address of the pointer since the documentation says " If
;the return value is a pointer, the
;memory address returned by the function will be placed in
;an IDL unsigned long and returned to the IDL application."

var = EXTPROC_DEREF(addr, FLOAT = 5)
;to dereference the pointer and copy the data pointed by it to an idl
variable
;it is supposed to copy the 5 float members of the C++ array to var

My problem is this:
addr does not point to a valid memory address, but points to 1 or
0..thus the next step of dereferencing also fails.

I know that it is not a problem with the dll or any such, since
returning a float or an int (not a pointer) works fine using this
approach. I need to pass the address since its a large array and want
to avoid writing my own DLM's for lack of skill.

Can anyone please help? I"m really stuck and dont know what to do..

Thanks all..
Re: Help! pointer address return using idl_tools DLM (EXTPROC_DEFINE) [message #38602 is a reply to message #38476] Fri, 12 March 2004 03:15 Go to previous message
mw vogel is currently offline  mw vogel
Messages: 3
Registered: February 2003
Junior Member
anand wrote:

> Hi
>
> I'm a newbie to Idl. I downloaded the idl_tools DLM library from Ronn
> Kling's website http://www.rlkling.com. I"m trying to access from idl
> the address of a float pointer returned by a function in C++.
> In my C++ program I have:
>
> float* cppfunc(int); //not part of any class
>
> I get the output of the C++ program as sample.dll file using visual
> studio 6.0
>
> In Idl I correspondingly use the call:
>
> addr = EXTPROC_DEFINE("idlfunc", "sample.dll", "cppfunc",
> "p(i)",/CDECL)
> ;to get the address of the pointer since the documentation says " If
> ;the return value is a pointer, the
> ;memory address returned by the function will be placed in
> ;an IDL unsigned long and returned to the IDL application."
>

Ok, my 2 cents :

This _DEFINE call only sets up an internal IDL command that connects to
your function in your DLL. To get valid output, you should actually use
the call. Probably something along the lines of p = idlfunc(0) . Then
use the DEREF to get the values from p.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: cw_field: checking entries
Next Topic: Maximum Likelihood processing time

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

Current Time: Thu Oct 09 21:25:33 PDT 2025

Total time taken to generate the page: 1.60022 seconds