sourcepawn/jit/x86/dll_exports.cpp
author Scott Ehlert <ds@alliedmods.net>
Sun Jul 15 08:00:26 2007 +0000 (2007-07-15)
changeset 1116 40cc5e9f0f1b
parent 653 ef60870067ff
child 1147 437e1f00a590
permissions -rw-r--r--
Removed strange debugging code
     1 /**
     2  * vim: set ts=4 :
     3  * ================================================================
     4  * SourcePawn (C)2004-2007 AlliedModders LLC.  All rights reserved.
     5  * ================================================================
     6  *
     7  * This file is not open source and may not be copied without explicit
     8  * written permission of AlliedModders LLC.  This file may not be redistributed 
     9  * in whole or significant part.
    10  * For information, see LICENSE.txt or http://www.sourcemod.net/license.php
    11  *
    12  * Version: $Id$
    13  */
    14 
    15 #include <sp_vm_api.h>
    16 #include <malloc.h>
    17 #include "jit_x86.h"
    18 #include "dll_exports.h"
    19 
    20 SourcePawn::ISourcePawnEngine *engine = NULL;
    21 JITX86 g_jit;
    22 
    23 EXPORTFUNC int GiveEnginePointer(SourcePawn::ISourcePawnEngine *engine_p)
    24 {
    25 	engine = engine_p;
    26 
    27 	return 0;
    28 }
    29 
    30 EXPORTFUNC unsigned int GetExportCount()
    31 {
    32 	return 1;
    33 }
    34 
    35 EXPORTFUNC SourcePawn::IVirtualMachine *GetExport(unsigned int exportnum)
    36 {
    37 	/* Don't return anything if we're not initialized yet */
    38 	if (!engine)
    39 	{
    40 		return NULL;
    41 	}
    42 
    43 	/* We only have one export - 0 */
    44 	if (exportnum)
    45 	{
    46 		return NULL;
    47 	}
    48 
    49 	return &g_jit;
    50 }
    51 
    52 #if defined __linux__
    53 extern "C" void __cxa_pure_virtual(void)
    54 {
    55 }
    56 
    57 void *operator new(size_t size)
    58 {
    59 	return malloc(size);
    60 }
    61 
    62 void *operator new[](size_t size) 
    63 {
    64 	return malloc(size);
    65 }
    66 
    67 void operator delete(void *ptr) 
    68 {
    69 	free(ptr);
    70 }
    71 
    72 void operator delete[](void * ptr)
    73 {
    74 	free(ptr);
    75 }
    76 #endif
    77