[Mono-dev] [PATCH] Use correct console code page on Windows (affects Linux as well)

Kornél Pál kornelpal at gmail.com
Mon Aug 7 11:09:50 EDT 2006


Hi,

Is a wrapper method necessary to avoid DLL loading? What if I use 
[MethodImplAttribute (MethodImplOptions.NoInlining)] on the P/Invoke method? 
Will P/Invoke methods be inlined without NoInlining?

Kornél

----- Original Message ----- 
From: "Zoltan Varga" <vargaz at gmail.com>
To: "Kornél Pál" <kornelpal at gmail.com>
Cc: <mono-devel-list at lists.ximian.com>
Sent: Thursday, July 27, 2006 6:50 PM
Subject: Re: [Mono-dev] [PATCH] Use correct console code page on Windows 
(affects Linux as well)


                         Hi,

  I think this can be solved by moving the windows specific code to a 
separate
method, marking it with [MethodImplAttribute (MethodImplOptions.NoInlining)]
and calling it from inside the if (OnWindows) block. That way, the pinvoke
lookups would not be executed on linux.

                  Zoltan

On 7/27/06, Kornél Pál <kornelpal at gmail.com> wrote:
> Hi,
>
> I recently posted this patch:
> http://lists.ximian.com/pipermail/mono-devel-list/2006-July/019433.html
>
> But I received no comments and didn't think that this can cause problems 
> on
> other OSes so I commited it:
> http://lists.ximian.com/pipermail/mono-patches/2006-July/077941.html
>
> This was later reverted by Miguel because he pointed out that this causes
> problems on non-Windows operating systems:
>
> >    There is already a process to fetch the proper encoding in the file,
> >and you added a new setup.   And to make things worse, considering the
> >inliner can decide to inline, this means that on Linux, we get an extra
> >hit for looking up kernel32.dll every time.
> >
> >    If this is required, discuss this on the list.
> >
> >open("/mono/lib/mono/1.0/advapi32.dll", O_RDONLY|O_LARGEFILE) = -1
> >ENOENT (No such file or directory)
> >open("/mono/lib/mono/1.0/kernel32.dll", O_RDONLY|O_LARGEFILE) = -1
> >ENOENT (No such file or directory)
> >open("/mono/lib/mono/1.0/ole32.dll", O_RDONLY|O_LARGEFILE) = -1 ENOENT
> >(No such file or directory)
>
> As for advapi32.dll and ole32.dll I don't think that these hints are 
> caused
> by my modifications.
>
> Windows uses different code pages (DOS code pages) for console than for 
> GUI
> applications (that is Encoding.Default) so this patch (or something
> functionally equivalent) is required.
>
> This initialization is done only once (in static constructor) so I don't
> think that it's worth to use ConsoleDriver in NET_1_1 as well.
>
> Please help to solve this problem occurring on Linux.
>
> Kornél
>
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
> 




More information about the Mono-devel-list mailing list