----- Original Message -----
From: "Rob Kennedy" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Tuesday, May 23, 2006 5:06 PM
Subject: Re: [delphi-en] Re: :(


> Mauro Russo wrote:
> > can someone explain me why i'm not able to pass to a function a
> > pointer of object using the '@'? What is amazing for me is that i could
do
> > it
> > whitout '@' (really i didn't try yet if it doesn't get exception at run
> > time).
> > The code is:
> >
> > type TVProc = Procedure(a: integer) cdecl stdcall;
>
> The calling convention of that function-pointer type is stdcall. The
> cdecl part is ignored. Is that what you intended?

Well, thanks. That explains something i had doubts about.

> > type TVMethod2 = Procedure(a: integer;b: integer) of object;
>
> The calling convention for that method-pointer type is register, which
> is not compatible with stdcall or cdecl.
>
> > procedure MyProc2Test(a : integer;b : integer);
> > begin
> > end;

sorry, here i forgot to report the "stdcall", but i have it in my code,
so it is compatible with TVProc.

> That is a two-argument function, which will not be compatible with
> TVProc or TVMethod2.
>
> > procedure TForm1.MyMethod2Test(a : integer;b : integer);
> > begin
> > end;
> >
> > TEcovDLL.Create(@MyProc2Test,MyMethod2Test);
> >
> > where:
> >
> > type TEcovDLL = class
> >    private
> >             ...
> >    public
> >       constructor
> >          Create(
> >             _Proc2_JustStartedAtmel : TVProc2;
> >             _Method2_JustStartedAtmel : TVMethod2);overload;
>
> What other constructors does this class have?

constructor Create();overload;

> > end;
> >
> > and the call is
> > ...
> > var ObjEcov : TEcovDLL;
> > ...
> >       ObjEcov := TEcovDLL.Create(@MyProc2Test,MyMethod2Test); //compile
>
> You shouldn't need the "@" operator for either of them.

Hm, i found the 'typed @' options disabled agina and after i enabled, you
are right.
I needn't the first '@'
.
> >     ObjEcov := TEcovDLL.Create(@MyProc2Test,@MyMethod2Test); //doesn't
> > compile
>
> "Doesn't compile" is not an adequate description. What specific compiler
> message do you get?

The message is just
"There is no overloaded versione of 'Create' that can be called with these
arguments".

> > If i write an other version of the constructor Create (class TEcovDLL),
> > declaring as 'overloaded'
> > both constructors, i'm not able anymore to call the first constructor
with
> > two parameters 'nil', but
> > i need to specify the pointer to object. What can be the cause?
>
> That's a little hard to tell since you haven't shown both constructors.
> My guess is that when you specify nil for both parameters, the compiler
> can't decide which overloaded version to call. Nil is a valid value for
> all procedure-pointer and method-pointer types.

constructor Create();overload;

> --
> Rob

I hoped you can reproduce the problem on your PC.

Best Regards,
Mauro Russo.

>
>
> -----------------------------------------------------
> Home page: http://groups.yahoo.com/group/delphi-en/
> To unsubscribe: [EMAIL PROTECTED]
> Yahoo! Groups Links
>
>
>
>
>
>
>



-----------------------------------------------------
Home page: http://groups.yahoo.com/group/delphi-en/
To unsubscribe: [EMAIL PROTECTED]




SPONSORED LINKS
C programming language Computer programming languages Java programming language
The c programming language C programming language Concept of programming language


YAHOO! GROUPS LINKS




Reply via email to