There are a few libraries that can help with this.
in reply to C Functions with variable argument list in perlxs
There are two portable, non-Perl specific libraries: One is libffi. The other is ffcall (ftp server not responding as I write this).
There is a Perl interface to ffcall: FFI.
If you are using Windows, you can use Win32::API.
If you use the FFI or Win32::API Perl modules, you may not need to write any XS code of your own.
Also, I can email a copy of ffcall-1.10.tar.gz if you have trouble downloading it. Just email me at kahirsch at cpan dot org.