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

Home » Public Forums » archive » objects and call external
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: objects and call external [message #29368 is a reply to message #29273] Tue, 12 February 2002 20:12 Go to previous message
Mark Rivers is currently offline  Mark Rivers
Messages: 49
Registered: February 2000
Member
Gert <gert.van.de.wouwer@NO_SPAMpandora.be> wrote in message
news:SJea8.136468$rt4.12914@afrodite.telenet-ops.be...
> hi,
>
> I try to use a call_external in an object method like this:


> pro MCP2000__DEFINE
> struct = {MCP2000, hComm: 0l, status: 0l}
> end

> function MCP2000::Init
> self.hComm = 0l
> return, 1
> end

> function MCP2000::InitPort
>
self.status=call_external('D:\Cpp\SerCommDll\Debug\SerCommDl l.dll','InitPort
Dll',$
> /PORTABLE,'COM1',self.hComm ,/UNLOAD)
> return, self.status
> end
>
> the idea is here that self.hComm contains a valid handle, but it doesnt -
it stays zero.

Your problem has nothing to do with CALL_EXTERNAL or the fact that you are
using an object method. The problem is that when you pass self.hComm (to
any routine) IDL views that as an "expression" and passes a copy of
self.hComm, not the address of self.hComm. Thus you cannot modify
self.hComm in the called routine. It is analogous to C passing integers by
value - the called routine can write into the function parameter, but the
calling routine does not see the resulting change. Your second way of doing
it is correct, pass "temp" and copy "temp" to self.hComm on the return.

Mark Rivers
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: XROI - how to invoke region growing
Next Topic: Re: Object method compiling

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

Current Time: Fri Oct 10 02:08:55 PDT 2025

Total time taken to generate the page: 1.19863 seconds