[26392] in Perl-Users-Digest
Perl-Users Digest, Issue: 8563 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Oct 24 14:05:25 2005
Date: Mon, 24 Oct 2005 11:05:05 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Mon, 24 Oct 2005 Volume: 10 Number: 8563
Today's topics:
Access a c++ module from Perl <temporary@mail.gr>
Re: FAQ 8.43 How do I open a file without blocking? xhoster@gmail.com
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 24 Oct 2005 18:21:59 +0300
From: "bg-greece" <temporary@mail.gr>
Subject: Access a c++ module from Perl
Message-Id: <djiua5$2s3g$1@ulysses.noc.ntua.gr>
I am using cygwin and perl and trying to access some function from a C++
windows dll. After the first attempt produced a segmentation fault, I tried
to do it step-by-step. I created a dummy function in the dll file:
int TestDLL(int x)
{
return 1;
}
and put the following code in a perl file:
use strict;
use Win32::API::Prototype;
my $TestDLL = ApiLink("mydll",'I TestDLL(I x)');
if (not defined $TestDLL) {
die "Can't import API TestDLL: $! \n";
}
print "ApiLink done\n";
my $xx = 0;
my $return = $TestDLL->Call($xx);
print $return."\n";
But even this produces a segmentation fault (core dump). Any ideas?
BG
------------------------------
Date: 24 Oct 2005 16:45:37 GMT
From: xhoster@gmail.com
Subject: Re: FAQ 8.43 How do I open a file without blocking?
Message-Id: <20051024124537.434$Lc@newsreader.com>
PerlFAQ Server <comdog@panix.com> wrote:
> This message is one of several periodic postings to comp.lang.perl.misc
> intended to make it easier for perl programmers to find answers to
> common questions. The core of this message represents an excerpt
> from the documentation provided with Perl.
>
> --------------------------------------------------------------------
>
> 8.43: How do I open a file without blocking?
>
> If you're lucky enough to be using a system that supports
> non-blocking reads (most Unixish systems do), you need only to use
> the O_NDELAY or O_NONBLOCK flag from the Fcntl module in conjunction
> with sysopen():
>
> use Fcntl;
> sysopen(FH, "/foo/somefile", O_WRONLY|O_NDELAY|O_CREAT, 0644)
> or die "can't open /foo/somefile: $!":
>
> --------------------------------------------------------------------
I think this FAQ should be removed. As far as I can tell, the question
is not frequently asked. Also, again as far as I can tell, even on
Unixish systems the solution only works on named pipes or other similarly
"special" files, not on regular files. Hence the answer is misleading to
everyone other than people who don't need to ask the question in the first
place.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc. For subscription or unsubscription requests, send
#the single line:
#
# subscribe perl-users
#or:
# unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.
#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 8563
***************************************