Problem using more than 1 module in Windows (XS) - please help

PERL

    Next

  • 1. how to check for ip address that falls inside a range.
    hi i need to verify if an ip-address falls inside a range for example, say 10.1.1.1 to 10.1.2.255. So if a user keys in 10.1.2.2, it should fall inside this range and then the program can do something. How can i go about declaring the range, and how can i check the ip whether it falls inside the range. ? thanks.
  • 2. {ipc - windows} -| no such command?
    According to perlipc you can open filehandles to the "filenames" -| and |- for forking a child and connecting the filehandle to either the child's STDOUT or STDIN and that works perfectly under unices. $pid = open(KID_TO_READ, "-|"); I'm writing a script which needs to work on Windows machines as well. Now when i try to use that construct it dies with the dreaded no-such-internal-or-external-command-error. Is there any way to do this in a portable fashion? Or at least in an if($^O eq "MSWin32") {} block?? The purpose of this is scanning a subnet for peer-to-peer webserver-thingies like the script itself and making a map of the entire network. This is the course of action when there's no list of hosts specified and the router doesn't support multicasting (gah). Depending on circumstances, quite some hosts might need to be tried so it gets awfully slow with only one thread using IO::Socket::INET (which, despite the manpage, has the timeout code commented out by the way). Thanks in advance, Steven Mocking. -- I never forget a face, but in your case I'll make an exception. -- Groucho Marx
  • 3. Upgrading
    Hello, If I want to upgrade from Perl 5.8.0 to 5.8.2_2, will I have to recompile/reinstall everything based on xs? I rather not. Thanks, - Pete
  • 4. Newbie question. Get list of files in subdir.
    How do I read in a list of all the files in a subdirectory? I just want to build a list of the .wav files that are in a folder so that I can feed them to an encoder. This should be very simple - so simple that I am obviously overlooking the obvious. However, I have learned a ton of stuff trying, for sure:) Thanks DH

Problem using more than 1 module in Windows (XS) - please help

Postby jatshergill » Wed, 20 Sep 2006 23:48:54 GMT

Hi all
	I have a problem that I am running into while using Perl XS to build
an interface to my C++ library. This is on a windows machine with perl
5.6.1. I was able to use PerlXS to expose out different 'c++
classes' that my API supports. I wrote the .XS files for each of
these objects and now I am able to make a simple test.pl file and use
these objects from Perl. The problem comes when I try to use more than
1 object (module) in a single .pl file. Here would an example

========== working example perl script  ================

use lib "C:/Documents and Settings/myusername/Desktop/perl
experiment/api";
use MyDataReader;
my $dr = new MyDataReader("hsd_demo_pre");
$dr->execQuery("select * from bug");
print "fields: " . $dr->getFieldCount() . "\n";


================== perl script giving problem =============
use lib "C:/Documents and Settings/myusername/Desktop/perl
experiment/api";
use MyDataReader;

use MyAdmin;   # Adding this line gives problems


my $dr = new MyDataReader("hsd_demo_pre");
$dr->execQuery("select * from bug");
print "fields: " . $dr->getFieldCount() . "\n";


========= Error Message ==================

C:\Documents and Settings\myusername\Desktop\perl experiment\api>perl
test.pl
Can't load 'C:\Documents and Settings\ myusername \Desktop\perl
experiment\api/5.6.1
/MyAdmin.dll' for module MyAdmin: load_file:Attempt to access invalid
address at C
:/Perl/lib/DynaLoader.pm line 206.
Compilation failed in require at test.pl line 11.
BEGIN failed--compilation aborted at test.pl line 11.


So the problem shows up when I use more than one 'use' statements
in a perl script. Its important to note here that I can use the
'MyAdmin' module by itself just fine. So its not aproblem with that
module. The problem is only when I try to use more than 1 module in a
single perl script.

==================== Makefile.PL ===================
use ExtUtils::MakeMaker;
$CC = 'cl';
# See lib/ExtUtils/MakeMaker.pm for details of how to influence
# the contents of the Makefile that is written.
WriteMakefile( 'NAME' => 'MyDataReader',
               'VERSION' => '0.10',
               'DEFINE'	=> '-TP -EHsc',     # e.g., '-DHAVE_SOMETHING'
               'CC' => $CC,
               'LDDLFLAGS' => '-nologo -libpath:"C:\Perl\lib\CORE"
-machine:x86',
			   'LIBC' => 'msvcrtd.lib',
			   'LDLOADLIBS' => 'oldnames.lib kernel32.lib user32.lib gdi32.lib
winspool.lib  comdlg32.lib advapi32.lib shell32.lib ole32.lib
oleaut32.lib  netapi32.lib uuid.lib wsock32.lib mpr.lib winmm.lib
version.lib odbc32.lib odbccp32.lib msvcrtd.lib',
			   'CCFLAGS' => '-nologo -O1 -MDd -DNDEBUG -DWIN32 -D_CONSOLE
-DNO_STRICT -DHAVE_DES_FCRYPT -DPERL_IMPLICIT_CONTEXT
-DPERL_IMPLICIT_SYS -DPERL_MSVCRT_READFIX',
               'LD' => '$(CC)',
               'XSOPT' => '-C++',
			   'OPTIMIZE' => '-O1 -MDd -DNDEBUG',
               'PERM_RW' => '664',
               'PERM_RWX' => '775',
               'TYPEMAPS' => ['perlobject.map']    ,
			    'INC'      => "-Iinclude",
          	'MYEXTLIB' => 'lib\myexternalapi.lib'
		       );

========== end =========


Similar Threads:

1.Installing XS Modules on Windows -- Like Pulling Teeth

I'm running on Windows with ActivePerl, and I'm trying to install
XML::LibXML. It's not in the PPM repository, so that's out of the
question. I downloaded MinGW, so I have gcc, and I downloaded both
nmake and dmake. I ran perl -MCPAN -e shell, and then install PAJAS/
XML-LibXML-1.64.tar.gz. But I get the error 'C:\Perl\bin\perl.exe
Makefile.PL' returned status 512, won't make. I searched all around
for some kind of instructions or tutorial, but very few are for
Windows and even fewer say anything useful.

So what are all the steps I need to perform to be able to install any
CPAN module on a Windows machine?

2.problems using graphviz perl module from apache (windows)

I'm writing a cgi script that uses graphviz (the dot program) to
generate a graph and I'm banging my head against the wall trying to get
it to work properly. Currently, if I run the script directly from the
command line, it will work properly and generate my graph (which gets
dumped into a file). If I invoke the script as a cgi script within
apache, it runs fine until it calls the as_png() function, at which
point it will die waiting for a result (the destination file is created
but is empty).

I'm running SERVER_SOFTWARE="Apache/2.0.52 (Win32)"
and version 1.8 of the GraphViz module. If I run a printenv.cgi, I get
the following path:

PATH="C:\Program Files\Perl\bin\;C:\Program Files\Reflection;C:\PROGRAM
FILES\THINKPAD\UTILITIES; C:\Program
Files\Java\j2re1.4.2_01\bin;C:\WINNT\system32;C:\WINNT;C:\WINNT\System32\Wbem;C:\Oracle\ora81\bin;C:\Program
Files\Oracle\jre\1.1.7\bin;C:\ISIS;C:\PROGRA~1\COMMON~1\MDL
Shared\ISIS;C:\PROGRA~1\ATT\Graphviz\bin;C:\PROGRA~1\ATT\Graphviz\bin\tools"

which does seem to have the correct path settings for dot.exe.

The error that the apache log gives me is: Premature end of script
headers: simplegraph.pl

If I remove the line that calls as_png(), the script runs fine.

Any assistance would be most appreciated. I've searched usenet but to
no avail...

Thanks!

Sergio.

3.Perl Module using XS

Hello "XS  Gurus":
I am trying to develop a perl extension using XS that would execute a DB2's 
'.sqc' generated c executable.( equivalent of Oracle's pro*c generated 
executable). The 'C' executable executes fine by itself.  I am having a hard 
time getting the perl module work.
I added in the '.xs' file the Xsubb for the function that is declared in the 
'C' program.
In the Makefile.PL, I added the object files generated from the 'C' program 
and also the path where the object file can be fouind.
Still, the make process does not succeed in building the 'C' function into 
the Perl module.
Could anyone show pointers as to what i am missing
thanks
Rajan


use 5.008008;
use ExtUtils::MakeMaker;
# See lib/ExtUtils/MakeMaker.pm for details of how to influence
# the contents of the Makefile that is written.
WriteMakefile(
        NAME              => 'RajanT',
        VERSION_FROM      => 'lib/RajanT.pm', # finds $VERSION
        PREREQ_PM         => {}, # e.g., Module::Name => 1.1
        ($] >= 5.005 ?     ## Add these new keywords supported since 5.005
        (ABSTRACT_FROM  => 'lib/RajanT.pm', # retrieve abstract from module
        AUTHOR         => 'Abishek Rajan < XXXX@XXXXX.COM >') : ()),
        LIBS              => [''], # e.g., '-lm'
        DEFINE            => '', # e.g., '-DHAVE_SOMETHING'
        INC               => '-I. -I/home/db2inst2', # e.g., 
'-I. -I/usr/include/other'
        MYEXTLIB => 'rlib/libmylib$(LIB_EXT)',
                # Un-comment this if you add C files to link with later:
                OBJECT            => '$(example2.o)', # link all the C files 
too
);
if  (eval {require ExtUtils::Constant; 1}) {
# If you edit these definitions to change the constants used by this module,
# you will need to use the generated const-c.inc and const-xs.inc
# files to replace their "fallback" counterparts before distributing your
# changes.
my @names = (qw(TESTVAL));
ExtUtils::Constant::WriteConstants(
NAME         => 'RajanT',
NAMES        => \@names,
DEFAULT_TYPE => 'IV',
C_FILE       => 'const-c.inc',
XS_FILE      => 'const-xs.inc',
);
}
else {
use File::Copy;
use File::Spec;
foreach my $file ('const-c.inc', 'const-xs.inc') {
my $fallback = File::Spec->catfile('fallback', $file);
copy ($fallback, $file) or die "Can't copy $fallback to $file: $!";
}
}

sub MY::postamble {
'
$(MYEXTLIB): rlib/Makefile
        cd rlib && $(MAKE) $(PASSTHRU)
';



4.Using Module::Build to XS

Hi,

I have volunterred to maintain the LSF::Base and LSF::Batch modules on
CPAN , I am in the process of rewriting the module's Makefile.PL
(which uses the ExtUtils::MakeMaker) to use the Module::Build's
Build.PL process. Unfortunately I have not been very successful in
writing the Build.PL to do all the complies. Also I have not been able
to gather any information regarding the use of Module::Build to do XS
complies. Any inputs on where I can get this information would be
really helpful.

I have tried to write the Build.PL by using the following code snippet
but this was not able to create the shared object for Dynaloader to
load.

my $builder = Module::Build->new(
    module_name         => 'LSF::Base',
    ...
    c_source             => 'lib/',
    include_dirs        => [ $lsf_includedir ] ,
    extra_linker_flags  => $libs,
    extra_compiler_flags => '-DPERL_POLLUTE',
    create_makefile_pl   => 'traditional'
);


Also any inputs on the Module::Build's equivalent of the below
Mafile.PL will be greatly appreciated.

WriteMakefile(
    'NAME'         => 'LSF::Base',
    'VERSION_FROM' => 'Base.pm',
    'LIBS'         => [$libs ],
    'DEFINE'       => '-DPERL_POLLUTE',
    'OBJECT'       => '$(O_FILES)',
    'INC'	       => "-I$lsf_includedir"
);

If this is a RTFM please do scream at me

Thanks
Raga

5.need template for an XS module using two or mor classes

Hi,

  I created with the tool "h2xs" a template for a perl package called

	"perlmsgque"

  in this package I want to add a "MqS" and a "MqSException" class.

  both class's should use an individual "*.xs" file called MqS.xs
  and MqSException.xs.

  I'm not able to get anything useful working with the current perl
  documentation.

  it seems that multiple packages into a single module is not
  covered

  one package per module is possible but multiple ....
  
  error message I get: Base class package "MqS" is empty

  even if MqS is filled ..


mfg

  Andreas Otto



6. Scalar::Util is not using XS in Fedora 8, leading to performance problem

7. Scalar::Util is not using XS in Fedora 8, leading to performance problem

8. Would like help on Perl script to print to windows printer, or printers, please



Return to PERL

 

Who is online

Users browsing this forum: No registered users and 52 guest