Multi-Platform Porting to 64-Bits  
by Brad Martin, Anita Rettinger, and Jasmit Singh


Listing One

#include <stdlib.h>
#include <stdio.h>

int Func1(char *);

int main()
{
   long arg, ret;
   arg = 247;
   ret = Func1((char *)&arg);

   printf("%ld\n", ret);

   return(0);
}
int Func1(char * input)
{
   int *tmp;

   tmp = (int *)input;
   return(*tmp);
}

Listing Two

typdef struct demo{
   int i;
   long j;
} DEMO;
 
DEMO test;
/*pout_raw outputs raw bytes to a file */
/* output each element of a structure to avoid padding */ 
pout_raw ((int) file_unit, (char *) test.i, sizeof (test.i)); 
pout_raw ((int) file_unit, (char *) test.j, sizeof (test.j));

/* the following line of code includes padding */ 
pout_raw ((int) file_unit, (char *) test,sizeof(test));





1


