New POW calculation module #1284

Open
Kleshni wants to merge 38 commits from Kleshni/POW into v0.6
6 changed files with 175 additions and 172 deletions
Showing only changes of commit cac0237ae0 - Show all commits

View File

@ -1,6 +1,12 @@
#ifndef COMMON_H #ifndef COMMON_H
#define COMMON_H #define COMMON_H
#ifdef _WIN32
#define EXPORT __declspec(dllexport)
#else
#define EXPORT __attribute__ ((visibility("default")))
#endif
extern volatile int run; extern volatile int run;
#define SEED_LENGTH (32 + 8) #define SEED_LENGTH (32 + 8)

View File

@ -1,4 +0,0 @@
{
global: fastsolver_*;
local: *;
};

View File

@ -1,8 +1,9 @@
CFLAGS += -std=gnu99 -Wall -Wextra -pedantic -O3 -fPIC CFLAGS += -std=gnu99 -Wall -Wextra -pedantic -O3 -fPIC -fvisibility=hidden
LDFLAGS += -shared -lpthread -lcrypto -Wl,-version-script=main.map LDFLAGS += -shared
LDLIBS = -lpthread -lcrypto
libfastsolver.so: main.map common.o pthread.o libfastsolver.so: common.o pthread.o
$(CC) $(LDFLAGS) -o $@ common.o pthread.o $(CC) $(LDFLAGS) -o $@ common.o pthread.o $(LDLIBS)
common.o: common.h common.c common.o: common.h common.c
pthread.o: common.h pthread.c pthread.o: common.h pthread.c

View File

@ -1 +1 @@
/Ox /MD common.c winapi.c /link /DLL /OUT:libfastsolver.dll /EXPORT:fastsolver_add /EXPORT:fastsolver_remove /EXPORT:fastsolver_search libcrypto.lib /Ox /MD common.c winapi.c /link /DLL /OUT:libfastsolver.dll libcrypto.lib

View File

@ -104,7 +104,7 @@ static int initialize(void) {
error_lock: return 0; error_lock: return 0;
} }
size_t fastsolver_add(void) { EXPORT size_t fastsolver_add(void) {
#ifdef SCHED_IDLE #ifdef SCHED_IDLE
int policy = SCHED_IDLE; int policy = SCHED_IDLE;
#else #else
@ -135,7 +135,7 @@ size_t fastsolver_add(void) {
return threads_count; return threads_count;
} }
size_t fastsolver_remove(size_t count) { EXPORT size_t fastsolver_remove(size_t count) {
size_t i; size_t i;
pthread_mutex_lock(&lock); pthread_mutex_lock(&lock);
@ -154,7 +154,7 @@ size_t fastsolver_remove(size_t count) {
return threads_count; return threads_count;
} }
int fastsolver_search( EXPORT int fastsolver_search(
char *local_nonce, char *local_nonce,
unsigned long long *local_iterations_count, unsigned long long *local_iterations_count,
const char *local_initial_hash, const char *local_initial_hash,

View File

@ -76,7 +76,7 @@ static int initialize(void) {
return 1; return 1;
} }
size_t fastsolver_add(void) { EXPORT size_t fastsolver_add(void) {
if (initialize() == 0) { if (initialize() == 0) {
return threads_count; return threads_count;
} }
@ -100,7 +100,7 @@ size_t fastsolver_add(void) {
return threads_count; return threads_count;
} }
size_t fastsolver_remove(size_t count) { EXPORT size_t fastsolver_remove(size_t count) {
size_t i; size_t i;
EnterCriticalSection(&lock); EnterCriticalSection(&lock);
@ -119,7 +119,7 @@ size_t fastsolver_remove(size_t count) {
return threads_count; return threads_count;
} }
int fastsolver_search( EXPORT int fastsolver_search(
char *local_nonce, char *local_nonce,
unsigned long long *local_iterations_count, unsigned long long *local_iterations_count,
const char *local_initial_hash, const char *local_initial_hash,