« New RTF functions com… | Home | A trip with the cable… »

When to initialize plugin libraries

Before using DynaPDF functions in our plugin, you have to initialize that part of the plugin. For that you call DynaPDF.Initialize function and pass path to the location of the DynaPDF dll or dylib.

Now our example code always used to use a $$DynaPDFInited variable to check the state. But that has two disadvantages:
  • First it may also be set if initialization failed. So if you run a script, it fails, you than put the library where it should be and try again, it will not initialize again.
  • Second with using a server, you may need to initialize both on server and client. But you only have one global variable. This causes trouble if initialization is done on client, but not on server.
  • Third on a server, if the Scripting Engine process is restarted, the variable has the wrong value as the DynaPDF library is unloaded with the end of that process.
So the new way we recommend is to use the DynaPDF.IsInitialized function to check the status. This way you can simply ask the plugin if it is initialized and call Initializ script as needed.
29 06 14 - 15:52