[Proj] wide char in pj_init_plus

Eric Miller emiller at dfg.ca.gov
Mon Mar 17 15:54:18 EDT 2008

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 >>>
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;

Proj mailing list
Proj at lists.maptools.org

More information about the Proj mailing list