What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Interop.GetCallbackPtr

Interop.GetCallbackPtr
Author: Message:
paulspiteri
New Member
*


Posts: 5
Joined: Oct 2008
O.P. Interop.GetCallbackPtr
Hi
I know there's a warning in GetCallbackPtr to not use it asyncronously, but how dangerous is that, really? I haven't done any experiments yet but I'm wondering how often the pointer really does change.
I've got a script that does some polling to a .NET DLL via COM to check if there's any new data, but i'd love to change that so the .NET code makes a callback to the script using this pointer.
I did try it actually, but couldn't convert the pointer into a delegate (anyone else tried that?). If i'm going to try again, i'm thinking of making a managed C++ assembly to make the callback call.

Anyone else out there have any thoughts?
Thanks
Paul
10-25-2008 01:34 PM
Profile E-Mail PM Find Quote Report
ShawnZ
Veteran Member
*****

Avatar

Posts: 3146
Reputation: 43
32 / Male / Flag
Joined: Jan 2003
RE: Interop.GetCallbackPtr
what are you doing in the  .NET dll exactly? you might be able to accomplish this just using scripting...
Spoiler:
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
10-25-2008 01:36 PM
Profile PM Web Find Quote Report
felipEx
Scripting Contest Winner
***


Posts: 378
Reputation: 24
35 / Male / Flag
Joined: Jun 2006
RE: Interop.GetCallbackPtr
quote:
Originally posted by paulspiteri
Hi
I know there's a warning in GetCallbackPtr to not use it asyncronously, but how dangerous is that, really?l
quote:
Originally posted by Patchou
The documentation specifically mentions that this function can only be used for synchronous calls. If you make a script that defys this rule, it may work at first but the combination of several scripts will certainely cause unexpected results / crashes.
quote:
Originally posted by Patchou
the problem is a technical limitation: for callbacks I dont have much other choice than using static functions in my code so I cant have two scripts using a callback at the same time, which is why they have to be synchronous.
...
Thus right now, calling GetCallbackPtr() many times, from different scripts, will always return the same pointer for a function with a given number of arguments.
read Cookie's reply
10-25-2008 08:57 PM
Profile E-Mail PM Find Quote Report
paulspiteri
New Member
*


Posts: 5
Joined: Oct 2008
O.P. RE: Interop.GetCallbackPtr
Okay I got it working

But I get a warning..

Bad calling convention detected for .......... The function must be declared with __stdcall and called with the appropriate number of parameter.


My function is defined as:

extern "C" _declspec(dllexport)int Test(int* test);

if i change it to
extern "C" _declspec(dllexport)int __stdcall Test(int* test);

then it says the function could not be found!

How do I fix that?
thanks
10-25-2008 11:43 PM
Profile E-Mail PM Find Quote Report
felipEx
Scripting Contest Winner
***


Posts: 378
Reputation: 24
35 / Male / Flag
Joined: Jun 2006
RE: Interop.GetCallbackPtr
RE: Trouble creating a DLL that works in Plus ;)
10-26-2008 12:07 AM
Profile E-Mail PM Find Quote Report
paulspiteri
New Member
*


Posts: 5
Joined: Oct 2008
O.P. RE: Interop.GetCallbackPtr
Hi
I'd already tried that - when i add __stdcall, it doesn't find the function at all!
Any ideas?
10-26-2008 02:14 PM
Profile E-Mail PM Find Quote Report
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On