[Proj] Compilation under Windows; DLL issues

proj-admin at remotesensing.org proj-admin at remotesensing.org
Thu Apr 15 09:03:58 EDT 2004

> Hi all,
> There are some issues using libproj as a DLL under Windows.
> The way the definitions currently are, it is not possible to access
> pj_errno or pj_release.
> The reasons for that are:
> *) pj_release is not defined as an export in proj.def
> *) pj_errno needs __declspec(dllimport) in its declaration to be accessible
> The second issue is a tricky one. Methods don't need the __declspec-stuff,
> they just get a second level of indirection in the code. Data, however, need
> that.


To get access to the errno value, windows applications are expected to call
pj_get_errno_ref() which returns a pointer to the pj_errno variable.  While
your approach can work, I decided that depending on the ability to export
variables from the DLL/shared library was likely to be a source of problems,
so I provided the function access.

I should have done the same for pj_release, but I wasn't aware anyone was using
it.  I have added a pj_get_release() function that will return the pj_release
string in CVS.  This will appear in the next release.

Best regards,

I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent

More information about the Proj mailing list