Is there any way to get makemaker to make 2 separate XS or 1 XS and 1 pure C DLLs on Windows?

I am trying to code a makefile.pl which will compile not only the XS DLL, but a pure C DLL which is dynamically loaded and unloaded (LoadLibrary/FreeLibrary) by the XS DLL.

I tried using the XS key  XS                 =>  {'ModuleName.xs' => 'ModuleName.c', 'ModuleNameCLib.xs' => 'ModuleNameCLib.c'}, in hash that goes to WriteMakefile, but the final makefile never mentions ModuleNameCLib, only ModuleName.

Edit, reading through the final makefile, it seems impossible for more than 1 DLL to be built. It seems to me, that the only thing I can do, is to put in my own target and hook it on INST_DYNAMIC_DEP, or overload the subdirs target. Copying of PMs are unlimited though, unlike XS or C parts of the perl module.

2nd edit, I figured this is the way to build another non-xs DLL with makemaker, works for me on windows with VS. Its added to makefile.pl the module ISN'T named 2ndlib BTW. We actually compiled 2ndlib.xs, not 2ndlib.c, but 2ndlib.xs is NOT an XS file, xsubpp will complain with

Didn't find a 'MODULE ... PACKAGE ... PREFIX' line

but it can be safely ignored I guess. I put the non-XS dll in a libs folder under the module's auto folder, to prevent dynaloader from trying to accidentally run the DLL, not sure what would happen if it was in the module's auto folder, 2ndlib.dll doesn't export a boot function. 2ndlib.dll isnt a real library, its just for this code sample.
package MY; sub postamble { return <<'ENDTOKEN'; dynamic:: $(INST_ARCHAUTODIR)\libs\2ndlib.dll $(INST_ARCHAUTODIR)\libs\2ndlib.dll : 2ndlib.obj $(LD) -out:$@ $(LDDLFLAGS) 2ndlib.obj $(OTHERLDFLAGS) $(MYEXTLIB) +$(PERL_ARCHIVE) $(LDLOADLIBS) -def:2ndlib.def $(INST_ARCHAUTODIR)\libs\.exists : Makefile.PL $(NOECHO) $(MKPATH) $(INST_ARCHAUTODIR)\libs $(NOECHO) $(CHMOD) $(PERM_DIR) $(INST_ARCHAUTODIR)\libs $(NOECHO) $(TOUCH) $(INST_ARCHAUTODIR)\libs\.exists blibdirs : $(INST_ARCHAUTODIR)\libs\.exists ENDTOKEN }

In reply to makemaker and building multiple DLLs by patcat88

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.