C/Visual C - Compilación en dev c++ a partir de .h y .cpp

 
Vista:

Compilación en dev c++ a partir de .h y .cpp

Publicado por Leo-Hypnostate (1 intervención) el 29/11/2012 08:45:03
Buenos días,

Estoy intentando compilar un par de archivos como una dll en el entorno dev c++. Dichos archivos pertenecen a una api de bmc Remedy para PHP (php_arapi). Tenéis más información aquí: http://php-arapi.sourceforge.net/examples.html. (Hay muy poca documentación en la web sobre este tema) La cuestión es que existen .dll ya compiladas para windows pero el apache no me las carga correctamente (utilizo un apache 2.4 con win 2003 y php 5). Por ello quería compilar yo mismo las .dll para mi windows pero me veo incapaz. Alguien podría ayudarme con la compilación? Hay alguna forma de hacerlo de forma rápida disponiendo de un archivo .h y un .cpp? Se que hay plantillas para crear la .dll, pero me pierdo... los códigos de ambos archivos, son los siguientes (muestro solo las primeras líneas):

php_arapi.cpp:
<code>
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include <cstdlib>
#include <cstring>

extern "C"
{
#include "php.h"
#include "ext/standard/info.h"

#include "php_arapi.h"
}

#include <Server.h>

//
// Normal function based interface to ARAPI.
//

typedef std::map< zval*, rtl::Server* > ObjServerMap;

rtl::Server* arapi_server = NULL;
ObjServerMap arapi_servers;

static rtl::Value ConvertZVAL2Value( const zval* Value )
{
if( Value == NULL ) return rtl::Value::NullValueImpl();

rtl::Value TmpValue;

zval TmpZVAL = *Value;
zval_copy_ctor( &TmpZVAL );

switch( Z_TYPE(TmpZVAL) )
{
case IS_NULL:
{
TmpValue = rtl::Value::NullValueImpl();
break;
}
case IS_LONG:
{
TmpValue = rtl::Value::IntegerValueImpl( Z_LVAL(TmpZVAL) );
break;
}
case IS_DOUBLE:
{
TmpValue = rtl::Value::RealValueImpl( Z_DVAL(TmpZVAL) );
break;
}
case IS_STRING:
{
TmpValue = rtl::Value::CharValueImpl( Z_STRVAL(TmpZVAL) );
break;
}
case IS_BOOL:
{
TmpValue = rtl::Value::IntegerValueImpl( Z_BVAL(TmpZVAL) );
break;
}

// You should newer use these datatypes for data to ARAPI. But we will
// convert them to string anyway. [@@:jpyllman]
case IS_ARRAY:
case IS_OBJECT:
case IS_RESOURCE:
case IS_CONSTANT:
case IS_CONSTANT_ARRAY:
default:
{
convert_to_string( &TmpZVAL );
TmpValue = rtl::Value::CharValueImpl( Z_STRVAL(TmpZVAL) );
break;
}
}

zval_dtor( &TmpZVAL );
return TmpValue;
}

</code>


php_arapi.h:

<code>
#ifndef PHP_ARAPI_H
#define PHP_ARAPI_H 1

#define PHP_ARAPI_VERSION "0.3.2"
#define PHP_ARAPI_EXTNAME "arapi"

extern zend_module_entry arapi_module_entry;
#define phpext_arapi_ptr &arapi_module_entry

PHP_MINFO_FUNCTION(arapi);
PHP_MINIT_FUNCTION(arapi);
PHP_MSHUTDOWN_FUNCTION(arapi);

#endif

</code>
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder