Valik Posted January 19, 2004 Share Posted January 19, 2004 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. Link to comment Share on other sites More sharing options...
Administrators Jon Posted January 19, 2004 Administrators Share Posted January 19, 2004 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? Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/ Link to comment Share on other sites More sharing options...
Administrators Jon Posted January 19, 2004 Administrators Share Posted January 19, 2004 There is an old explanation of something similar in application.cpp, search for "C++ Gotcha" Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/ Link to comment Share on other sites More sharing options...
Valik Posted January 19, 2004 Author Share Posted January 19, 2004 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. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now