[Proj] wide char in pj_init_plus

Martin Kofahl martin.kofahl at uni-rostock.de
Tue Mar 18 00:08:20 PDT 2008


Thanks for the .net wrapper! However, according to 
http://msdn2.microsoft.com/de-de/library/system.runtime.interopservices.charset.aspx 
Charset.Ansi ist not available on .netcf, so this is more a general 
problem on windows mobile.

Martin


Eric Miller wrote:
> I don't know about the mobile edition, but generally for PInvoke,
> adding Charset=Ansi to the attributes for your function definition is
> sufficient in .Net.
> 
> See,
> http://ftp.dfg.ca.gov/Public/BDB/Tools/proj4/csharp/proj_api.cs.txt
> 
>>>> Martin Kofahl <martin.kofahl at uni-rostock.de> 03/17/08 1:00 AM
>>>> >>>
> Hi, I had some troubles making proj work on a windows mobile 6
> device. Initialization failed because of I could not PInvoke
> pj_init_plus using CharSet.Ansi which is probably not supported in
> vs.net (only auto and unicode). I did add a function pj_init_plusW to
> pj_init.c for converting wchar* to char*, but isn't there another way
> in order to stay compatible?
> 
> 
> PJ * pj_init_plusW( const wchar_t *definition )
> 
> char *defn_copy; PJ   *result;
> 
> defn_copy = (char *) pj_malloc( wcslen(definition)+1 ); 
> sprintf(defn_copy, "%S", definition);
> 
> result = pj_init_plus(defn_copy);
> 
> pj_dalloc( defn_copy );
> 
> return result; }
> 
> 
> Martin



More information about the Proj mailing list