UDF на 64битной ОС
Добавлено: 06 дек 2010, 17:03
Есть исходник который использовали только для Вин32 и Линукс32 и 64.
Счас возникла необходимость сделать и для ВИн64.
Код приблительно такой:
Естествено в таком виде не компилилась длл, но если прямо прописать дефайн32, то компилится без ошибок, но ФБ всеравно ругается на entry point.
Буду рад любой помощи, заранее спасибо
Счас возникла необходимость сделать и для ВИн64.
Код приблительно такой:
Код: Выделить всё
#if defined(_LP64) || defined(__LP64__) || defined(__arch64__)
typedef int ISC_LONG;
typedef unsigned int ISC_ULONG;
#else
typedef signed long ISC_LONG;
typedef unsigned long ISC_ULONG;
#endif
typedef struct {
ISC_LONG quad_high;
ISC_ULONG quad_low;
} ISC_QUAD;
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <sys/timeb.h>
#ifdef WIN32
#include <windows.h>
#include <intrinsics.h>
#else
#include <unistd.h>
#endif
#include <time.h>
typedef unsigned long long int64;
int64 starttime[20] = {0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0};
const char * SetLEnglish = "abcdefghijklmnopqrstuvwxyz";
const char * SetLRussian = "aбвгдеёжзийклмопрстуфхцчшщьыъэюяіїє\'";
const char * SetHRussian = "АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЬЫЪЭЮЯІЇЄ\'";
const char * SetHEnglish = "ABCDEFGHIJKLMNOPQRSTUVWXYZ'`";
const char * SetDigits = "0123456789";
int64 CPUClock = 2128;
int RisidualTime = 64;
int TimerIsInitialized = 0;
#ifndef WIN32
#define __declspec(x)
#endif
double __declspec(dllexport) fn_ceiling (double* a)
{
return ceil(*a - 0.00000000001);
}
double __declspec(dllexport) fn_floor (double* a)
{
return floor(*a + 0.00000000001);
}
#ifdef WIN32
double __declspec(dllexport) fn_round (double* a)
{
double v;
if (*a>=0) v=(fmodl(*a,1)<0.499999999) ? floor(*a) : ceil(*a);
else v=(fmodl(fabsl(*a),1)<0.499999999) ? -floor(fabsl(*a)):-ceil(fabsl(*a));
return v;
}
#else
double fn_round (double* a)
{
double v;
if (*a>=0) v=(fmod(*a,1)<0.499999999) ? floor(*a) : ceil(*a);
else v=(fmod(fabs(*a),1)<0.499999999) ? -floor(fabs(*a)):-ceil(fabs(*a));
return v;
}
#endif
#ifdef WIN32
BOOL WINAPI __declspec(dllexport) LibMain(HINSTANCE hDLLInst, DWORD fdwReason, LPVOID lpvReserved)
{
switch (fdwReason)
{
case DLL_PROCESS_ATTACH:
// The DLL is being loaded for the first time by a given process.
// Perform per-process initialization here. If the initialization
// is successful, return TRUE; if unsuccessful, return FALSE.
break;
case DLL_PROCESS_DETACH:
// The DLL is being unloaded by a given process. Do any
// per-process clean up here, such as undoing what was done in
// DLL_PROCESS_ATTACH. The return value is ignored.
break;
case DLL_THREAD_ATTACH:
// A thread is being created in a process that has already loaded
// this DLL. Perform any per-thread initialization here. The
// return value is ignored.
break;
case DLL_THREAD_DETACH:
// A thread is exiting cleanly in a process that has already
// loaded this DLL. Perform any per-thread clean up here. The
// return value is ignored.
break;
}
return TRUE;
}
#endif
Буду рад любой помощи, заранее спасибо