X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=tests%2Fuffi-c-test-lib.c;h=26884c638a6e20033ab37ec96adf27d5357afe03;hb=166794962329e880a7c690b71c849262ee1f729f;hp=d8e9b49aa152a4782fa361f2413b47ba3cd294f6;hpb=bdb966b22ea563a7dfa1f464a1b6cb6d8b5a712c;p=uffi.git diff --git a/tests/uffi-c-test-lib.c b/tests/uffi-c-test-lib.c index d8e9b49..26884c6 100644 --- a/tests/uffi-c-test-lib.c +++ b/tests/uffi-c-test-lib.c @@ -6,7 +6,7 @@ * Programer: Kevin M. Rosenberg * Date Started: Mar 2002 * - * CVS Id: $Id: uffi-c-test-lib.c,v 1.1 2003/04/29 14:08:02 kevin Exp $ + * CVS Id: $Id: uffi-c-test-lib.c,v 1.4 2003/08/15 02:34:34 kevin Exp $ * * This file, part of UFFI, is Copyright (c) 2002 by Kevin M. Rosenberg * @@ -39,6 +39,15 @@ BOOL WINAPI DllEntryPoint(HINSTANCE hinstdll, #include +DLLEXPORT unsigned char uchar_13 = 13; +DLLEXPORT signed char schar_neg_120 = -120; +DLLEXPORT unsigned short uword_257 = 257; +DLLEXPORT signed short sword_neg_321 = -321; +DLLEXPORT unsigned int uint_1234567 = 1234567; +DLLEXPORT signed int sint_neg_123456 = -123456; +DLLEXPORT double double_3_1 = 3.1; +DLLEXPORT float float_neg_4_5 = -4.5; + /* Test of constant input string */ DLLEXPORT int @@ -93,3 +102,40 @@ half_double_vector (int size, double* vec) +DLLEXPORT +void * +cast_test_int () { + int *x = (int *) malloc(sizeof(int)); + *x = 23; + return x; +} + +DLLEXPORT +void * +cast_test_float () +{ + double *y = (double *) malloc(sizeof(double)); + *y = 3.21; + return y; +} + +DLLEXPORT int fvar_addend = 3; + +typedef struct { + int i; + double d; +} fvar_struct_type; + +fvar_struct_type fvar_struct = {42, 3.2}; + +DLLEXPORT +int fvar_struct_int () { + return (fvar_addend + fvar_struct.i); +} + +DLLEXPORT +double fvar_struct_double () { + return fvar_struct.d; +} + +