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 

My COM got crazy!

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi OLE Automation
View previous topic :: View next topic  
Author Message
Miroo_news
Guest





PostPosted: Mon Dec 15, 2003 7:27 am    Post subject: My COM got crazy! Reply with quote



I don't know what happened.
One day TLB changed all my functions in COM into
procedures. Why? What happened? What I did wrong?

I've just clicked "Refresh" i TLB and it happened.
And there appeared such lines:
procedure MyFunction(parameters) = function MyFunction(parameters)

Could you help me?

Best regards,
Miroo

Back to top
John Carlyle-Clarke
Guest





PostPosted: Tue Dec 16, 2003 10:36 am    Post subject: Re: My COM got crazy! Reply with quote



"Miroo_news" <miroo (AT) USUNTO (DOT) poczta.fm> wrote in news:brjnu2$8h5$1 (AT) atlantis (DOT) news.tpi.pl:

Quote:
I don't know what happened.
One day TLB changed all my functions in COM into
procedures. Why? What happened? What I did wrong?


Here's my guess....

I've seen this happen when I've changed the setting controlling safecall mapping (which is in the
options).

For example:

function MyMethod(AParam : widestring) : HRESULT; // No safecall mapping

becomes:

procedure MyMethod(AParam : widestring); safecall;

( Read this page if you don't know what safecall mapping is:
http://www.techvanguards.com/stepbystep/comdelphi/components.asp )

Quote:
I've just clicked "Refresh" i TLB and it happened.
And there appeared such lines:
procedure MyFunction(parameters) = function MyFunction(parameters)



If you change this setting on an existing project, the IDE tries to create the new methods, but finds
methods with the same name already existing (but with a different definition).

In this case, what it does is create things like (can't remember exactly)

procedure IMyInterface.MyMethod = IMyInterface_MyMethod;
procedure IMyInterface_MyMethod(AParam : widestring); safecall;

This is because it had to use a different name, and then it created a Method Resolution Clause to
ensure the "right" thing got called.

Search the Delphi help for "Method resolution clauses" for more info.

Hope that helps!

Back to top
John Carlyle-Clarke
Guest





PostPosted: Tue Dec 16, 2003 10:38 am    Post subject: Re: My COM got crazy! Reply with quote



"John Carlyle-Clarke" <john.cc (AT) nospam (DOT) europlacer.co.uk> wrote in
news:Xns94536BF3517D2johncceuroplacercouk (AT) 192 (DOT) 168.1.69:

Quote:
I've seen this happen when I've changed the setting controlling
safecall mapping (which is in the options).

I forgot to say, this can also happen if you have the safecall mapping set for "Dual interfaces" and
you change the interface type so that it becomes dual, or becomes not dual. Either way will cause a
change.


Back to top
Miroo_news
Guest





PostPosted: Tue Dec 16, 2003 12:57 pm    Post subject: Re: My COM got crazy! Reply with quote

Użytkownik "John Carlyle-Clarke" <john.cc (AT) nospam (DOT) europlacer.co.uk> napisał w
wiadomości news:Xns94536C40E1538johncceuroplacercouk (AT) 192 (DOT) 168.1.69...
Quote:
"John Carlyle-Clarke" <john.cc (AT) nospam (DOT) europlacer.co.uk> wrote in
news:Xns94536BF3517D2johncceuroplacercouk (AT) 192 (DOT) 168.1.69:

I've seen this happen when I've changed the setting controlling
safecall mapping (which is in the options).

Thank you!
This is exactly what happened. I've probably changed
one of interfaces into DUAL.
Everything's clear now.

Best regards,
Miroo


Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi OLE Automation 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.