[Proj] wide char in pj_init_plus

Martin Kofahl martin.kofahl at uni-rostock.de
Mon Mar 17 01:00:07 PDT 2008


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