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 #29353 is a reply to message #29273] Wed, 13 February 2002 06:18 Go to previous messageGo to previous message
Gert Van de Wouwer is currently offline  Gert Van de Wouwer
Messages: 21
Registered: January 2002
Junior Member
ok I already got the answer: i cannot pass something like self.hComm by
reference (which was in the manual anyway...)




"Gert Van de Wouwer" <Gert.VandeWouwer@NOSPAMua.ac.be> wrote in message
news:a4dp0b$qib$1@naxos.belnet.be...
>
> all right, so passing is self.hcom is pass by value; passing hcomm is pass
> by reference. Is there a way to pass self.hcomm by reference; i.e. the
> c-analgo would be &(self.hcomm)...?
>
>
>
> "Mark Rivers" <rivers@cars.uchicago.edu> wrote in message
> news:RLla8.194$x4.4337@news.uchicago.edu...
>>
>> 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: Sat Oct 11 16:01:30 PDT 2025

Total time taken to generate the page: 2.15736 seconds