----- Original Message ----- From: "robert" <[EMAIL PROTECTED]> To: <perl-win32-users@listserv.ActiveState.com> Sent: Wednesday, July 20, 2005 1:27 PM Subject: send output to a parallel port?
> Hey all > > we have some devices at work that are controlled by sending signals via the > computer's parallel port. (because all the serial ports are being used > elsewhere) > > the parallel port (LPT) has the address 0x378. to do this in C, its quite > simple: > > void parallel_device (int state) > { > outp (0x378,state); > return; >} Afaik a function declared as void would not return. Anyway, if it's that simple to do in C then it's also very simple to achieve in perl, using Inline::C. Here is the script (untested): --start test.pl use warnings; use strict; use Inline C => Config => LIBS => '', # specify additional libs - eg '-lmylib' BUILD_NOISY => 1; # verbose output during compilation use Inline C => <<'EOC'; //#include <whatever.h> // List any includes here void inline_parallel_device(int state) { outp(0x378, state); } EOC; # perl code starts here: my $state = 12345; # or whatever you want # inline_parallel_device() does exactly the same as parallel_device(). inline_parallel_device($state); # Then do whatever it is you want to do. __END__ --- end test.pl --- But you'll need a compiler for that to work - preferably MSVC++ 6.0 if you're running ActiveState perl, though the free command line version of MSVC++ 7.1 (.NET 2003 .... or whatever it is) that's available from Microsoft will probably serve just as well. With ActiveState perl, a third alternative is to install nmake or dmake, and the MinGW (gcc) compiler, along with ExtUtils::FakeConfig. (All of those are freely available.) Cheers, Rob _______________________________________________ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs