
Errores portando aplicaciones C++ Windows a Solaris (II)
28/12/2012Al portar una aplicación C++ para Windows desarrollada enVisual Studio hacia Solaris o entornos Unix, se recomienda utilizar las siguientes conversiones y consejos.
CONVERSIÓN VISUAL STUDIO A C++
Tipos equivalentes en Visual Studio y Solaris:
_isnan → isnan
__Int64 → long long
PVOID pvData; → typedef void *PVOID;
__forceinline double CALERF(double ARG, int JINT) → inline
const BSTR ToBSTR() const throw (Exceptions::cException); → typedef char* BSTR;
"src/Utils/strings/cAnsiString.cpp", line 707: Error: The function "_snprintf" must have a prototype.
Sustituir por «snprintf»
"headers/Utils/cVariant.h", line 12: Error: Could not open include file<oaidl.h>
Prescindir de él (comentarlo), definiendo las variables como LPVARIANT en cVariant.h (e incluir esta cabecera en su lugar).
m_variant.bstrVal = ::SysAllocString(str);, SysAllocString is not a member of file level
sustituir por algo equivalente a:
m_variant.bstrVal = _bstr_t bstrt(str);
struct cTypeFunction {
enum Type
{
MIN,
MAX,
MULT,
SUM,
};
};
sustituir por algo equivalente a:
struct cTypeFunction
{
typedef enum
{
MIN,
MAX,
MULT,
SUM
} Type;
};
Conversiones habituales de tipos:
typedef unsigned short WORD;
typedef short BOOL;
typedef void *LPVOID;
typedef const void *LPCVOID;
typedef unsigned char UCHAR;
typedef unsigned char *PUCHAR;
typedef unsigned short USHORT;
typedef int32_t LONG;
typedef uint32_t ULONG;
typedef ULONG *PULONG;
typedef ULONG DWORD;
typedef DWORD *PDWORD;
typedef LONG RESPONSECODE;
typedef char *LPSTR;
typedef const char *LPCSTR;
typedef const BYTE *LPCBYTE;
typedef BYTE *LPBYTE;
typedef DWORD *LPDWORD;
typedef void *PVOID;
Deja una respuesta