[Mono-list] Need help with DllImport (P/Invoke) and UCS-4 unicode

Andreas Färber andreas.faerber at web.de
Tue Jul 17 13:00:38 EDT 2007


Am 17.07.2007 um 17:28 schrieb Christian Heimes:

> Miguel de Icaza wrote:
>> Sadly, you have to do it manually.
>>
>> We brought this up a few times at ECMA and three or four times with
>> different people at Microsoft and we did not get very far.     The
>> solution is trivial, and we could implement it in Mono (expand the
>> CharSet definition to include UTF8, UCS4 explicit encodings), but it
>> would not be compatible with .NET, so we decided against doing it.
>
> It's a shame that a product which is advertised cross platform
> compatible doesn't implement or at least provide support for important
> standards. IIRC Charset.Unicode is equal to Little Endian UCS-2.  
> Charset
> does neither take UTF-8 and UCS-4 nor Big Endian into account. :(

.NET was never advertised as cross-platform to my knowledge. That's a  
feature introduced by Mono.
Windows had A and W APIs corresponding to SBCS and UCS-2 so that's  
the options Microsoft needed and that's what we got...


Miguel, if we don't want to extend the official class library why not  
do it the way the SDF does it for .NET CF? Mono could provide a  
separate enumeration/attribute/etc. in a Mono namespace, call it the  
same or <origName>Ex and extend that "copy" using an Adapter pattern  
or inheritance where possible (for example to enhance  
System.Windows.Forms.Application they have  
OpenNetCF.Windows.Forms.ApplicationEx I believe). That'll still not  
work on .NET but would be a clean way to let Mono developers do their  
work while clarifying through the namespace and reference to an  
assembly that it's an extension. (On the other hand, .NET developers  
will be used to reading the documentation's small print on what is  
available in which version of .NET/.NETCF/Windows so long-term it  
might be acceptable to actually extend the original class library and  
to conditionally emit warnings when used.)

And if short-term a custom marshaler is needed as a workaround  
wouldn't that be a prime candidate for a Mono-bundled and .NET- 
compatible library, say Mono.InteropServices? Instead of telling  
people a recipe to cook their own.

Just a thought,

Andreas


More information about the Mono-list mailing list