Skip to content

Commit 5e3bc56

Browse files
Homme Zwaagstratbonfort
Homme Zwaagstra
authored andcommitted
Remove redundant call to msDebugInitFromEnv (MapServer#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 MapServer#4522
1 parent e9e4894 commit 5e3bc56

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

cgiutil.h

+7
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@
3232
#ifndef CGIUTIL_H
3333
#define CGIUTIL_H
3434

35+
#ifdef __cplusplus
36+
extern "C" {
37+
#endif
3538

3639
#if defined(_WIN32) && !defined(__CYGWIN__)
3740
# define MS_DLL_EXPORT __declspec(dllexport)
@@ -93,4 +96,8 @@ MS_DLL_EXPORT cgiRequestObj *msAllocCgiObj(void);
9396
MS_DLL_EXPORT void msFreeCgiObj(cgiRequestObj *request);
9497
#endif /*SWIG*/
9598

99+
#ifdef __cplusplus
100+
}
101+
#endif
102+
96103
#endif /* CGIUTIL_H */

mapserv.c

+5-3
Original file line numberDiff line numberDiff line change
@@ -140,10 +140,12 @@ int main(int argc, char *argv[])
140140
struct mstimeval execstarttime, execendtime;
141141
struct mstimeval requeststarttime, requestendtime;
142142
mapservObj* mapserv = NULL;
143-
msSetup();
144143

145-
/* Use MS_ERRORFILE and MS_DEBUGLEVEL env vars if set */
146-
if( msDebugInitFromEnv() != MS_SUCCESS ) {
144+
/* -------------------------------------------------------------------- */
145+
/* Initialize mapserver. This sets up threads, GD and GEOS as */
146+
/* well as using MS_ERRORFILE and MS_DEBUGLEVEL env vars if set. */
147+
/* -------------------------------------------------------------------- */
148+
if( msSetup() != MS_SUCCESS ) {
147149
msCGIWriteError(mapserv);
148150
msCleanup(0);
149151
exit(0);

0 commit comments

Comments
 (0)