stub_plugin/h_export.cpp
author Scott Ehlert <ds@alliedmods.net>
Thu Sep 26 15:56:37 2013 -0500 (2013-09-26)
changeset 280 622b9760d7ae
parent 0 d15304fcb7a7
child 282 7a10fd71909a
permissions -rw-r--r--
Avoid linking to libstdc++ on Linux.
darope@0
     1
// vi: set ts=4 sw=4 :
darope@0
     2
// vim: set tw=75 :
darope@0
     3
darope@0
     4
// From SDK dlls/h_export.cpp:
darope@0
     5
darope@0
     6
/***
darope@0
     7
*
darope@0
     8
*	Copyright (c) 1999, 2000 Valve LLC. All rights reserved.
darope@0
     9
*	
darope@0
    10
*	This product contains software technology licensed from Id 
darope@0
    11
*	Software, Inc. ("Id Technology").  Id Technology (c) 1996 Id Software, Inc. 
darope@0
    12
*	All Rights Reserved.
darope@0
    13
*
darope@0
    14
*   Use, distribution, and modification of this source code and/or resulting
darope@0
    15
*   object code is restricted to non-commercial enhancements to products from
darope@0
    16
*   Valve LLC.  All other use, distribution, or modification is prohibited
darope@0
    17
*   without written permission from Valve LLC.
darope@0
    18
*
darope@0
    19
****/
darope@0
    20
/*
darope@0
    21
darope@0
    22
===== h_export.cpp ========================================================
darope@0
    23
darope@0
    24
  Entity classes exported by Halflife.
darope@0
    25
darope@0
    26
*/
darope@0
    27
darope@0
    28
#include <extdll.h>
darope@0
    29
darope@0
    30
#include <h_export.h>
darope@0
    31
darope@0
    32
// From SDK dlls/h_export.cpp:
darope@0
    33
darope@0
    34
//! Holds engine functionality callbacks
darope@0
    35
enginefuncs_t g_engfuncs;
darope@0
    36
globalvars_t  *gpGlobals;
darope@0
    37
darope@0
    38
// Receive engine function table from engine.
darope@0
    39
// This appears to be the _first_ DLL routine called by the engine, so we
darope@0
    40
// do some setup operations here.
darope@0
    41
void WINAPI GiveFnptrsToDll( enginefuncs_t* pengfuncsFromEngine, globalvars_t *pGlobals )
darope@0
    42
{
darope@0
    43
	memcpy(&g_engfuncs, pengfuncsFromEngine, sizeof(enginefuncs_t));
darope@0
    44
	gpGlobals = pGlobals;
ds@280
    45
ds@280
    46
// Avoid linking to libstdc++
ds@280
    47
#if defined(linux)
ds@280
    48
extern "C" void __cxa_pure_virtual(void)
ds@280
    49
{
darope@0
    50
}
ds@280
    51
ds@280
    52
void *operator new(size_t size)
ds@280
    53
{
ds@280
    54
	return malloc(size);
ds@280
    55
}
ds@280
    56
ds@280
    57
void *operator new[](size_t size)
ds@280
    58
{
ds@280
    59
	return malloc(size);
ds@280
    60
}
ds@280
    61
ds@280
    62
void operator delete(void *ptr)
ds@280
    63
{
ds@280
    64
	free(ptr);
ds@280
    65
}
ds@280
    66
ds@280
    67
void operator delete[](void * ptr)
ds@280
    68
{
ds@280
    69
	free(ptr);
ds@280
    70
}
ds@280
    71
#endif}