[Mono-list] Diagnostic Messages

Jonathan Pryor jonpryor@vt.edu
29 May 2002 21:06:08 -0400


I did as you suggested, preforming a runtime check before executing
`OutputDebugString'.

There's one problem with this: On Linux, test programs display the
following:

	** (process:1556): WARNING **: Failed to load function
	OutputDebugString from kernel32.dll

For a point of comparison, .NET doesn't display any warnings/errors if I
DllImport a function and library that doesn't exist.  If I try to *call*
it, it throws an exception (as expected), but I get no extraneous output
if I never call it.

Would it be possible to remove the above warning message?

Thanks,
 - Jon

On Mon, 2002-05-27 at 22:57, Miguel de Icaza wrote:
    > I do agree that on Win32 OutputDebugString should be used.  However,
    > before I implement that I need to figure out how to properly make the C#
    > code conditional, for either Win32 or Unix systems.  This would likely
    > require changing the `System.build' file, and probably introduces
    > logistical issues.  For example, if we did this, we would have a
    > `System.dll' that was specific to Windows or specific to Linux. 
    > `corlib.dll' need to do the same thing, so this shouldn't be a major
    > issue.
    
    You can do this dynamically, just probe the OS (I forget how to do this,
    but it is done in a few places in the class libraries) and execute the
    code that you need to do:
    
    if (is_windows){
        OutputDebugString (...);
    } else {
    }
    
    OutputDebugString is probably a Dllimported method, so unless you
    actually invoke it, the code will just work fine.
    
    Miguel.
    
    _______________________________________________
    Mono-list maillist  -  Mono-list@ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list