| View previous topic :: View next topic |
| Author |
Message |
Miroo_news Guest
|
Posted: Mon Dec 15, 2003 7:27 am Post subject: My COM got crazy! |
|
|
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
|
Posted: Tue Dec 16, 2003 10:36 am Post subject: Re: My COM got crazy! |
|
|
"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
|
Posted: Tue Dec 16, 2003 10:38 am Post subject: Re: My COM got crazy! |
|
|
"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
|
Posted: Tue Dec 16, 2003 12:57 pm Post subject: Re: My COM got crazy! |
|
|
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 |
|
 |
|