BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Getting pointer to overloaded procedure

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Language BASM
View previous topic :: View next topic  
Author Message
William Egge
Guest





PostPosted: Wed Dec 27, 2006 7:18 pm    Post subject: Getting pointer to overloaded procedure Reply with quote



Can anyone tell me a way I can get a pointer to an overloaded procedure or
function?

For instance:

procedure Test(S: string); overload;
procedure Test(I: Integer); overload;

..
..
..
var
PToStr, PToInt: Pointer;

PToStr:= @Test; // ??
PToInt:= @Test; // ??
Back to top
Pieter Zijlstra
Guest





PostPosted: Wed Dec 27, 2006 9:17 pm    Post subject: Re: Getting pointer to overloaded procedure Reply with quote



William Egge wrote:

Quote:
Can anyone tell me a way I can get a pointer to an overloaded
procedure or function?

For instance:

procedure Test(S: string); overload;
procedure Test(I: Integer); overload;

var
PToStr, PToInt: Pointer;


By using typed procedure pointers...

type
PProcS = procedure(S: string);
PProcI = procedure(I: Integer);

var
PToStr: PProcS;
PToInt: PProcI;
begin
PToStr := Test;
PToInt := Test;


--
Pieter
Back to top
William Egge
Guest





PostPosted: Fri Dec 29, 2006 8:05 pm    Post subject: Re: Getting pointer to overloaded procedure Reply with quote



Thanks, do you know if there is a way without having to do that?

Like something that requires no setup?
Back to top
Pieter Zijlstra
Guest





PostPosted: Fri Dec 29, 2006 10:52 pm    Post subject: Re: Getting pointer to overloaded procedure Reply with quote

William Egge wrote:

Quote:
Thanks, do you know if there is a way without having to do that?
Like something that requires no setup?

Not that I know of, but maybe there is fancy asm trick which does the
job, you're in the right group for that Smile
Basically you need a way to tell the compiler which overloaded
procedure it should use. If the compiler 'thinks' that one of them is
not used it will not generate code for it. I don't know any other way
then using using typed procedure pointers to do that.

--
Pieter
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Language BASM All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.