[Mono-bugs] [Bug 467214] New: Setting $LD_LIBRARY_PATH using SetEnvironmentVariable does not affect search path used by PInvoke

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Sun Jan 18 17:01:11 EST 2009


           Summary: Setting $LD_LIBRARY_PATH using SetEnvironmentVariable
                    does not affect search path used by PInvoke
    Classification: Mono
           Product: Mono: Runtime
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: interop
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: mtraudt at quantifisolutions.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---

Created an attachment (id=265906)
 --> (https://bugzilla.novell.com/attachment.cgi?id=265906)
Code sample that can be used to reproduce the problem

User-Agent:       Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; SLCC1;
NET CLR 2.0.50727; .NET CLR 1.1.4322; .NET CLR 3.5.21022; .NET CLR 3.5.30729;
NET CLR 3.0.30618)

With MS CLR, I can set my DLL search path in my program using
Environment.SetEnvironmentVariable() and this will affect the search path used
by P/Invoke.

With Mono however, this has no effect.  I have to set %PATH% (on Windows) or
$LD_LIBRARY_PATH (on Linux) before starting my program in order for P/Invoke to
find my shared library.

Reproducible: Always

Steps to Reproduce:
1. Unzip attached code sample
2. cd into the top-level folder
3. cd CppLibrary
4. gmake
5. cd ..
6. gmake
7. Run Program.exe with both MS and Mono CLR

The provided Makefiles should work from a VS2005 or VS2008 command shell.  If
you need to build on Linux with Mono/GCC or have other packaging requirements,
let me know (I created the test case on Windows because it made it easy to
compare results).

Actual Results:  
With MS CLR, the Program should run without error, and print a result (3).

With Mono CLR, you will get a DllNotFoundException.

Expected Results:  
I expect to get the same behavior with Mono as with MS.

Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.

More information about the mono-bugs mailing list