Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

Re^2: MakeMaker tailoring

by cdarke (Prior)
on Jan 24, 2008 at 13:30 UTC ( #664011=note: print w/replies, xml ) Need Help??

in reply to Re: MakeMaker tailoring
in thread MakeMaker tailoring

If I understand you correctly, that will compile the files as seperate relocatable objects, and link them with perl.

The idea of my code is that the DLL is "injected" into another process, which is probably non-perl. This is done by waving a magic wand and sacrificing a goat (but not necessarily in that order). The DLL has to be a discrete executable in order for the alien process to run it.

Thanks anyway.

Replies are listed 'Best First'.
Re^3: MakeMaker tailoring
by roboticus (Chancellor) on Jan 24, 2008 at 13:45 UTC
    I don't believe that the presence of the XS interface would preclude the use of the dll for injection into other processes. Just provide your normal dll interface for your other code in addition to the XS stuff. So one copy will be loaded with perl and use the XS interface, and when you inject the DLL into other processes, the other processes will use the other interface.

    Note: I'm assuming Windows here (where the above will work). I've not tried it in *NIX, though I don't know of any reason that it wouldn't work there.

    Alternatively, can't you just add your rule to build the other DLL and add it as a dependency to the XS DLL?


      OK, I see what you mean, but any idea how I do that using MakeMaker and Makefile.PL? Open the Makefile conventionally and change it long-hand? I was wondering if there was MakeMaker magic to do it.

      Yes, this is Windows. I have no idea how to do this from *NIX, it should be possible though since gdb -p and strace -p can.
Re^3: MakeMaker tailoring
by randyk (Parson) on Jan 24, 2008 at 16:25 UTC
    In this case, would something like the following work?
    package main; use strict; use warnings; use ExtUtils::MakeMaker qw( WriteMakefile ); my $parms = { NAME => 'Module::Name', }; WriteMakefile( %$parms ); package MY; sub postamble { return <<'MAKE_FRAG'; new_target: $(PERL) -e "print qq{Hello from new_target\n}" MAKE_FRAG } sub top_targets { my $inherited = shift->SUPER::top_targets(@_); $inherited =~ s/(\npure_all\s+::.+)/$1 new_target/; return $inherited; } 1;
    This adds a new new_target target, which is then carried out at the nmake stage, without having to specify nmake new_target explicitly.
      Excellent! That works! I didn't know about top_target, many thanks.

      Nice ++ you just saved me the trouble of learning MakeMaker for another month or two... ;^)


Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://664011]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (2)
As of 2022-09-26 00:21 GMT
Find Nodes?
    Voting Booth?
    I prefer my indexes to start at:

    Results (116 votes). Check out past polls.