Jump to content
  • Advertisement
Sign in to follow this  
Night_Wulfe

Access to COM Objects in Windows

This topic is 4402 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

First, let me say this is a wonderful script engine and I'd like to thank the developer(s) for taking the time to both write, maintain, and enhance AngelScript. Big thumbs up for that. I have a question about the ability to access an interface defined by a COM object at script run time on Windows machines. Other script languages determine whether or not a function/method exists at run time. This allows someone writing a "COM Object Module" to intercept the undefined method/function calls and inspect the appropriate COM obect to see if that method/function exists within it using the COM Object's Type Library. I realize that the functionality is probably not built into AngelScript. From what I understand, AngelScript checks method and class names at compile time. I have no problem with any of this and I'm not requesting this to change. Given that, I believe the best solution would be to use an existing third party preprocessor, or write my own, to implement functionality similar to Visual Studio's #import statement. Basically, from what I can tell, this loads the COM Object's type library auto-register the COM Object's interfaces, methods, and constants with AngelScript at compile time. Does this seem like a reasonable approach? I realize that using COM objects themselves may not be reasonable to some of you, but some of us don't have much of a choice. I'd like to use AngelScript in my project, but the ease in which this capability can be added is a big factory in whether or not I can use AngelScript. Thanks for any input.

Share this post


Link to post
Share on other sites
Advertisement
It shouldn't be hard. You can get function points into com objects, after all. The biggest issue I think you'll run into is converting type names to the names used in Angelscript. Here's basically what you will have to do.

-Get the com object
-For each function to be bound;
--Build a string containing the complete function signature, as Angelscript will see it
--Get the function pointer
--Bind it.

Doesn't look that hard at all. If you write a generic com-object-binder, please post it up here. :)

Share this post


Link to post
Share on other sites
Your approach seems quite reasonable to me.

As COM objects are reference counted they should be quite easy to bind with AngelScript.

Once you know how to determine the function signature from the type library it shouldn't be difficult to register it. I know there exists standard components for reading the type library already, I just don't know the name of them anymore.

You may need to think a bit about how to handle the string type, as it is a special type in the COM world. But this shouldn't be too difficult to register either.

Share this post


Link to post
Share on other sites
Quote:
Once you know how to determine the function signature from the type library it shouldn't be difficult to register it. I know there exists standard components for reading the type library already, I just don't know the name of them anymore.


This so far has been my problem. I'm sure the capability exists as I see programs like studio's Object Inspector. However, I have yet to find anything in my spare time stating how this is done. I assume it requires the use of the type library but I see no methods in the appropriate C++ interfaces that seem to help.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Look for ITypeInfo interface.


- Gilad Novik

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!