Sha256: c70621b02dae87c25289c4c4849f9db0a171907162fdbd1c4e2e462268a6386c

Contents?: true

Size: 1.2 KB

Versions: 58

Compression:

Stored size: 1.2 KB

Contents

/*
 * Copyright (c) 2007 Wayne Meissner. All rights reserved.
 *
 * For licensing, see LICENSE.SPECS
 */

#ifdef _WIN32
#include <windows.h>
#define sleep(x) Sleep(x)
#endif

#ifndef _WIN32
#include <unistd.h>
#include <pthread.h>
#endif

int testAdd(int a, int b)
{
    return a + b;
};

int testFunctionAdd(int a, int b, int (*f)(int, int))
{
    return f(a, b);
};

void testBlocking(int seconds) {
    sleep(seconds);
};

struct async_data {
    void (*fn)(int);
    int value;
};

static void* asyncThreadCall(void *data)
{
    struct async_data* d = (struct async_data *) data;
    if (d != NULL && d->fn != NULL) {
        (*d->fn)(d->value);
    }

    return NULL;
}

void testAsyncCallback(void (*fn)(int), int value)
{
#ifndef _WIN32
    pthread_t t;
    struct async_data d;
    d.fn = fn;
    d.value = value;
    pthread_create(&t, NULL, asyncThreadCall, &d);
    pthread_join(t, NULL);
#else
    (*fn)(value);
#endif
} 

#if defined(_WIN32) && !defined(_WIN64)
struct StructUCDP {
  unsigned char a1;
  double a2;
  void *a3;
};

void __stdcall testStdcallManyParams(long *a1, char a2, short int a3, int a4, __int64 a5,
            struct StructUCDP a6, struct StructUCDP *a7, float a8, double a9) {
}
#endif

Version data entries

58 entries across 40 versions & 10 rubygems

Version Path
vagrant-unbundled-1.9.1.1 vendor/bundle/ruby/2.4.0/gems/ffi-1.9.10/libtest/FunctionTest.c
vagrant-compose-yaml-0.1.3 vendor/bundle/ruby/2.2.0/gems/ffi-1.9.10/libtest/FunctionTest.c
vagrant-compose-yaml-0.1.2 vendor/bundle/ruby/2.2.0/gems/ffi-1.9.10/libtest/FunctionTest.c
vagrant-compose-yaml-0.1.1 vendor/bundle/ruby/2.2.0/gems/ffi-1.9.10/libtest/FunctionTest.c
vagrant-compose-yaml-0.1.0 vendor/bundle/ruby/2.2.0/gems/ffi-1.9.10/libtest/FunctionTest.c
tdiary-5.0.1 vendor/bundle/gems/ffi-1.9.10/libtest/FunctionTest.c
vagrant-unbundled-1.8.1.1 vendor/bundle/ruby/2.3.0/gems/ffi-1.9.10/libtest/FunctionTest.c
dwolla_swagger-1.0.6 vendor/bundle/ruby/2.2.0/gems/ffi-1.9.10/libtest/FunctionTest.c
mastermind_adeybee-0.1.4 vendor/bundle/ruby/2.2.0/gems/ffi-1.9.10/libtest/FunctionTest.c
yakg-0.1.11 vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/libtest/FunctionTest.c
yakg-0.1.11 vendor/gems/ruby/2.0.0/gems/ffi-1.9.10/libtest/FunctionTest.c
yakg-0.1.11 vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/libtest/FunctionTest.c
yakg-0.1.10 vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/libtest/FunctionTest.c
yakg-0.1.10 vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/libtest/FunctionTest.c
yakg-0.1.10 vendor/gems/ruby/2.0.0/gems/ffi-1.9.10/libtest/FunctionTest.c
yakg-0.1.9 vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/libtest/FunctionTest.c
yakg-0.1.9 vendor/gems/ruby/2.0.0/gems/ffi-1.9.10/libtest/FunctionTest.c
yakg-0.1.9 vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/libtest/FunctionTest.c
yakg-0.1.8 vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/libtest/FunctionTest.c
yakg-0.1.8 vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/libtest/FunctionTest.c