1 /***************************************************************************
5 * Purpose: Test functions in C for UFFI library
6 * Programer: Kevin M. Rosenberg
7 * Date Started: Mar 2002
11 * This file, part of UFFI, is Copyright (c) 2002-2005 by Kevin M. Rosenberg
13 * These variables are correct for GCC
14 * you'll need to modify these for other compilers
15 ***************************************************************************/
20 BOOL WINAPI DllEntryPoint(HINSTANCE hinstdll,
27 #define DLLEXPORT __declspec(dllexport)
38 DLLEXPORT unsigned char uchar_13 = 13;
39 DLLEXPORT signed char schar_neg_120 = -120;
40 DLLEXPORT unsigned short uword_257 = 257;
41 DLLEXPORT signed short sword_neg_321 = -321;
42 DLLEXPORT unsigned int uint_1234567 = 1234567;
43 DLLEXPORT signed int sint_neg_123456 = -123456;
44 DLLEXPORT double double_3_1 = 3.1;
45 DLLEXPORT float float_neg_4_5 = -4.5;
47 /* Test of constant input string */
50 cs_count_upper (char* psz)
65 /* Test of input and output of a string */
68 cs_to_upper (char* psz)
72 *psz = toupper (*psz);
78 /* Test of an output only string */
81 cs_make_random (int size, char* buffer)
84 for (i = 0; i < size; i++)
85 buffer[i] = 'A' + (rand() % 26);
89 /* Test of input/output vector */
92 half_double_vector (int size, double* vec)
95 for (i = 0; i < size; i++)
104 int *x = (int *) malloc(sizeof(int));
113 double *y = (double *) malloc(sizeof(double));
120 return_long_negative_one ()
127 return_int_negative_one ()
134 return_short_negative_one ()
139 DLLEXPORT int fvar_addend = 3;
146 fvar_struct_type fvar_struct = {42, 3.2};
149 int fvar_struct_int () {
150 return (fvar_addend + fvar_struct.i);
154 double fvar_struct_double () {
155 return fvar_struct.d;