Came across an interesting little problem I thought others might find
amusing:

In a new C++ module for the server dll, I have the following:

#include "extdll.h"
.
.
.
extern "C" {
#include "pm_debug.h"
}

pm_debug.h contains the following prototype:
void PM_DrawRectangle(vec3_t tl, vec3_t bl, vec3_t tr,
                         vec3_t br, int pcolor, float life);

Everything compiled without a peep from the compiler, but the program
crashed when I called PM_DrawRectangle from the C++ module.  Tracing
through in the debugger, I noticed that the copy constructor for class
Vector was being called during the call to PM_DrawRectangle!  The
preprocessor replaced all the "vec3_t"s with "Vector", because extdll.h
#defines vec3_t as Vector.  The linker didn't complain, either, which I
can't say I understand, since in the preprocessor output for pm_debug.c the
vec3_t's are unchanged.

Jim


_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders

Reply via email to