Fix LibraryImport problemTag(s): Common problems
Thanks to J. Lakeman
When importing a datawindow into your application using LibraryImport, you will sometimes come across a situation where Powerbuilder has a read only file handle on the library you are attempting to import into. In this case the LibraryImport method will fail without returning any error text. This occurs because Powerbuilder caches information and file handles that it has obtained from your libraries. But there is a way to force Powerbuilder to clean them up. Simply open a window.
Powerbuilder caches all of this information while a window is openeing as this is the time where multiple class definitions must be loaded and every little bit of speed helps. But when the window has finished opening, these handles will be cleaned up.
li_ret = LibraryImport & ('library', 'object', ImportDataWindow!, 'syntax', ls_error, 'comments') IF li_ret<0 AND ls_error='' THEN // a child window that is invisible and will close itself immediately open(w_dummy) li_ret = LibraryImport & ('library', 'object', ImportDataWindow!,'syntax', ls_error, 'comments') END IF