Date: prev next · Thread: first prev next last
2011 Archives by date, by thread · List index


On Wednesday 03 of August 2011, Caolán McNamara wrote:
On Tue, 2011-08-02 at 14:58 +0200, Lubos Lunak wrote:
- osl_loadModule*() functions are plain C functions from stable API, so
no overloading to add the extra argument for the error message, the best
I've come up with was simply a wrapper around dlerror(), which I admit is
not very nice API either, would there be any better approach?

Has the obvious issue of an gap between error and retrieving the error
and some other thread churning away in between, how about...

 That's already inherent in dlerror() itself, I have no idea how this is 
handled on Windows.

A oslModule is a void* and we're currently just directly casting the
return from dlopen (and the windows equivalent) to a oslModule

Maybe one possibility is instead a private struct like

struct unx_impl_Module
{
      void *m_pRealHandle;
      const char *m_pLastError;
};

in osl/unx/module.c, malloc one of those and return *that* as the
oslModule from the osl_loadModule* family. Free it in osl_unloadModule.
Do the fixup in the various methods to cast oslModule to unx_impl_Module
and get the realhandle out of it for the dl* family. Now can add a new
toplevel osl c-function to check for error.

oslModule stays a void* and all should remain abi-groovy methinks ?

 That is a clever hack, but API-wise I consider it so ugly that I'd rather 
prefer the extra osl_loadModuleWithError() variants than this.

-- 
 Lubos Lunak
 l.lunak@suse.cz

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.