Permalink
Browse files

Remove redundant call to msDebugInitFromEnv (#4522)

`msSetup()` already calls `msDebugInitFromEnv()`.

Specify correct "C" linkage in `cgiutil.h`

`cgiutil.h` is the only file included by `mapserver.h` which defines
symbols and which isn't wrapped by `extern "C"`: its symbols end up in
`libmapserver` and without this fix linking against them in C++ fails.

closes #4522
  • Loading branch information...
1 parent e9e4894 commit 5e3bc561ae9f2e1bd97e75ab1cfe2e2baa270a31 @homme homme committed with tbonfort Nov 12, 2012
Showing with 12 additions and 3 deletions.
  1. +7 −0 cgiutil.h
  2. +5 −3 mapserv.c
View
@@ -32,6 +32,9 @@
#ifndef CGIUTIL_H
#define CGIUTIL_H
+#ifdef __cplusplus
+extern "C" {
+#endif
#if defined(_WIN32) && !defined(__CYGWIN__)
# define MS_DLL_EXPORT __declspec(dllexport)
@@ -93,4 +96,8 @@ MS_DLL_EXPORT cgiRequestObj *msAllocCgiObj(void);
MS_DLL_EXPORT void msFreeCgiObj(cgiRequestObj *request);
#endif /*SWIG*/
+#ifdef __cplusplus
+}
+#endif
+
#endif /* CGIUTIL_H */
View
@@ -140,10 +140,12 @@ int main(int argc, char *argv[])
struct mstimeval execstarttime, execendtime;
struct mstimeval requeststarttime, requestendtime;
mapservObj* mapserv = NULL;
- msSetup();
- /* Use MS_ERRORFILE and MS_DEBUGLEVEL env vars if set */
- if( msDebugInitFromEnv() != MS_SUCCESS ) {
+ /* -------------------------------------------------------------------- */
+ /* Initialize mapserver. This sets up threads, GD and GEOS as */
+ /* well as using MS_ERRORFILE and MS_DEBUGLEVEL env vars if set. */
+ /* -------------------------------------------------------------------- */
+ if( msSetup() != MS_SUCCESS ) {
msCGIWriteError(mapserv);
msCleanup(0);
exit(0);

0 comments on commit 5e3bc56

Please sign in to comment.