Jump to content

Recommended Posts

Posted

Jon, I'm curious, why exactly is g_oScript a global object? To me, it looks like you could create a local AutoIt_Script object in AutoIt_App::Run and just use that. The reason I bring this up is because I modified the global list of script objects to make the list non-static. Now I have to rely on the order global objects are created in or else AutoIt_Script won't get registered. The list object has to be created before the script object. Seems a dangerous thing to rely on to me.

  • Administrators
Posted

The only reason I can remember is that there are a number of API callback functions used. The callback functions were dsigned for C and you have to jump through hoops to force them to use a function in a C++ class - the workaround involves a global.

Have a look in the script_win.cpp for g_oScript.

As for the order, can you not simply create everything with "new" in the order you want?


 

  • Administrators
Posted

There is an old explanation of something similar in application.cpp, search for "C++ Gotcha"


 

Posted

DUH, I remember now. At the very least you have a static function returning the g_oScript member version for the message handler or something. I think that's where the "C++ Gotcha" part is.

I guess I'll just wrap the global objects in a function and call new on them (And write one for delete).

Thanks, Jon.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...