&someFunctionDefinedInThePlugin), but you should be careful not to pass in a pointer that could be dynamically allocated - since that will likely either fail, or point you to the memory space of the host process. Your home Library Application Support SIMBL Plugins GreaseKit.bundle Relaunch your Safari. GreaseKit GreaseKit.bundle And paste the copy in the /Library/Application Support/SIMBL/Plugins. Handle lookup of &someSymbol, you can also use a reference to a function (e.g. Please copy 'GreaseKit' bundle from the downloaded Disk Image. If (dladdr(&someVariable, &info) != 0) loaded from %s", info.dli_fname) that will be statically compiled into the plugin. but we can just as easily use a function pointer or similar - anything We'll be using a reference to this variable compiled into the plugin, The runtime lookup can look as follows: // Sample: BundleClass.m, the principal class for the plugin Given an address in an executable, the dladdr function can be used to query the dynamic linker about the dynamically-linked image containing that address i.e., given a reference to a symbol in your plugin, dladdr can give you the dynamic linking information about your plugin. Is there any other way to find out the folder my plugin code is executing from? It seems like a simple request, but I am coming up empty. It would potentially be multiple instances of the same version. For other similar classes this would be fine for my plugin, because my unique class names are macros that equate to a mangled name that includes the version number, but in this case it isn't okay. The problem is that if multiple instances of my bundle are loaded (from different folders), Cocoa complains that the class MY_BUNDLE_ID_CLASS is defined in multiple locations and won't guarantee me which one was used. SIMBL-related files can be found either in /Library/Application Support/SIMBL/Plugins or /Library/Application Support/SIMBL/Plugins. Once I have the correct NSBundle, getting the file path is trivial. SIMBL is not a part of Apple's Mac OS X package, but is an extension that can be used by other developers in their own work to extend applications where they may not have the original source code (like Safari). I could create a special class called MY_BUNDLE_ID_CLASS and use: ] This issue I have is this: I need to find out what directory my plugin is executing in. Third parties could bundle this plugin with a custom configuration for their script(s) and they would appear as separate items in the app's plugin menu. It is a Lua interpreter, and the goal is for each instance to host a different configuration of lua scripts that appear in separate menus on the host application. (The UI is largely provided by API calls into the host app.) One of the requirements is that the plugin bundle can be loaded multiple times from different sub-directories. It is almost entirely written in C++ and has only minimal objective-c components. I am working on a SIMBL Plugin that is loaded by a 3rd-party host application on macOS.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |