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

Home » Public Forums » archive » make_dll and call_external woes
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
make_dll and call_external woes [message #70469] Sun, 18 April 2010 15:02 Go to previous message
James[2] is currently offline  James[2]
Messages: 44
Registered: November 2009
Member
Hi everyone,

I'm working on some code that's loop-heavy, so I'd like to do the
loopy part with an external C program. I'm using MAKE_DLL to compile
and then CALL_EXTERNAL. My system is Windows XP with the Microsoft
Visual C++ Express compiler, running in 32-bit mode.

I'm using very large data sets, so I would like to pass only pointers
to my C function. I wrote a little test program like this. It takes
all the arguments that my actual program needs, but it just alters one
value to see if anything happens:

void raycast(unsigned char * image, unsigned char * angles, unsigned
char * magnitudes, int * dims)
{
angles[0] = 100;
}

I compile this using MAKE_DLL successfully. I've tested if the code
is getting called by adding an IDL_message(), and it works - the
message prints out on the IDL console. Unfortunately, the above code
does not work. I call it in IDL like this:

[stack is a preexisting 3-dimensional byte array]
dims = fix(size(*stack, /dimensions))
angles = ptr_new(bytarr(dims))
magnitudes = ptr_new(bytarr(dims))
dimsptr = ptr_new(long(reverse(dims)))
call_external (dir + "raycast.dll", "raycast", $
stack, angles, magnitudes, dimsptr, /cdecl, /all_value)

but when I check the value of (*angles)[0] afterward, it's still 0. I
also check with max(*angles) and it's 0 as well. Why is my C program
not changing anything in the array? I get the same problem whether I
include the /ALL_VALUE keyword or not.

Many thanks to anyone who can make sense of this issue!
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: READS: End of input data encountered
Next Topic: Problem using the method List->ToArray()

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

Current Time: Wed Oct 08 15:07:58 PDT 2025

Total time taken to generate the page: 0.00444 seconds