Help! pointer address return using idl_tools DLM (EXTPROC_DEFINE) [message #38476] |
Thu, 11 March 2004 08:43  |
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..
|
|
|