POV-Ray : Newsgroups : povray.general : POV-CSDL (or Java Binding?) : Re: POV-CSDL (or Java Binding?) Server Time
10 Aug 2024 09:19:08 EDT (-0400)
  Re: POV-CSDL (or Java Binding?)  
From: Jon A  Cruz
Date: 16 Mar 2000 12:21:53
Message: <38D119A3.810FE60E@geocities.com>
Nieminen Juha wrote:

>   How do you get more than one value returned from a method in C++?
>   Of course you can get a class (or struct) instance, but it's still just one
> value.

Easily:

int foo( int &out1, int &out2, int &out3,  int in1 );

Most any Win32 COM stuff starts to act like that.

Here's the IDL stuff on the basic IDispatch interface. The invoke one is a call worth
noticing.

interface IDispatch : public IUnknown
                    {

                        public:

                        virtual HRESULT STDMETHODCALLTYPE GetTypeInfoCount(
                        /* [out] */ UINT __RPC_FAR *pctinfo) = 0;

                        virtual HRESULT STDMETHODCALLTYPE GetTypeInfo(
                        /* [in] */ UINT iTInfo,
                        /* [in] */ LCID lcid,
                        /* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo) = 0;

                        virtual HRESULT STDMETHODCALLTYPE GetIDsOfNames(
                        /* [in] */ REFIID riid,
                        /* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames,
                        /* [in] */ UINT cNames,
                        /* [in] */ LCID lcid,
                        /* [size_is][out] */ DISPID __RPC_FAR *rgDispId) = 0;

                        virtual /* [local] */ HRESULT STDMETHODCALLTYPE Invoke(
                        /* [in] */ DISPID dispIdMember,
                        /* [in] */ REFIID riid,
                        /* [in] */ LCID lcid,
                        /* [in] */ WORD wFlags,
                        /* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams,
                        /* [out] */ VARIANT __RPC_FAR *pVarResult,
                        /* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo,
                        /* [out] */ UINT __RPC_FAR *puArgErr) = 0;

                    };

and you might get something like this in the header files:
#define
IDispatch_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr)
\
    (This)->lpVtbl ->
Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr)


You can do things a little like that in Java, but you have to really work hard to do
so.


>   I'm not saying that Java is a bad language. It's safer and often more
> pleasant to look at than C++. It's harder to make bad programming with it
> (although possible).
>   I just don't like the limits it imposes. Sorry :)

Then you know the tasks you need to acomplish, and have made good evaluations based on
that.
A good programmer knows when to use which tools.

--
"My new computer's got the clocks, it rocks
But it was obsolete before I opened the box" - W.A.Y.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.