[Libreoffice] ChDir and user written dll

Noel Power nopower at novell.com
Wed Apr 27 05:11:42 PDT 2011


Hi
On 26/04/11 20:46, pjpuchyr wrote:
> Running calc, I need to load a dll which is not in the search path, and my
> problem is
> that the Basic ChDir statement does nothing on Windows 7, so the dll can
> never be found.
> Is there a solution to this problem?
afaik ChDir doesn't work on *any* platform from 
LibreOffice/Openoffice.org Basic
> To elaborate,  I've written an app which runs as a dll loaded by a
> spreadsheet.   My clients
> are engineers who do not have administrator privileges on their machines, so
> the dll is
> typically not put in the standard search path for dlls.   One of the
> spreadsheet inputs is the
> path to the dll, which is picked up by the Basic code.   On systems where
> ChDir works,
This is what's confusing me, I presume you Microsoft Office ( Excel ) 
when you say "On systems where ChDir works" right?
> I simply ChDir to the specified directory and the dll loads.
how do you intend to load/access the dll in libreoffice, via Declare 
syntax ?
> In OpenOffice/LibreOffice, ChDir does nothing (doesn't work and doesn't
> issue an error),
which is strange :-/ but looks to have been done purposely :-/
> so my alternatives are
> 1) hard code the full path into the Basic Declare statement, which is
> unacceptable because
>     I have no control over where the dll is put
ah, ok you are using 'Declare' Hmm assuming that 'ChDir' is a non runner 
then there are a couple of possibilities
    a)  you  could expose your functionality via a dreaded extension ( 
and provide a thin uno interface wrapper for your dll ) - your users 
would have an extra step of having to install the extension
    b) you could convert your dll to be a binary, you could launch the 
binary via the 'Shell' command. Getting information back from your 
application might be more difficult you probably would need to do some 
custom handshaking... yeuch  forget it, actually your best bet is an 
extension
    c)  if your functionality is somewhat generic and useful you could 
consider adding it to the calc core and have it generally available to 
everyone

Noel


More information about the LibreOffice mailing list