chromatic wrote: > On Friday 22 December 2006 11:08, Ron Blaschke wrote:
>> There are three steps necessary (four using VC8). >> >> 1) Two additional functions need to be exported. >> Parrot_register_pmc >> Parrot_unregister_pmc > > In some .def file somewhere, or marked somehow in the source code? The necessary change is: ---- $ svn diff include/parrot/extend.h Index: include/parrot/extend.h =================================================================== --- include/parrot/extend.h (revision 16218) +++ include/parrot/extend.h (working copy) @@ -121,8 +121,8 @@ Parrot_Language Parrot_find_language(Parrot_INTERP, char*); -void Parrot_register_pmc(Parrot_INTERP, Parrot_PMC); -void Parrot_unregister_pmc(Parrot_INTERP, Parrot_PMC); +PARROT_API void Parrot_register_pmc(Parrot_INTERP, Parrot_PMC); +PARROT_API void Parrot_unregister_pmc(Parrot_INTERP, Parrot_PMC); Parrot_PMC Parrot_get_dod_registry(Parrot_INTERP); ---- I thought I'd collect everything necessary together and submit a single patch. >> 2) Change the compiler and linker flags. >> >> 3) Add the path to parrot.dll to Path, so it can be found during (test) >> execution. > > That's tough on all platforms. Is it a simple case of adding ../../blib/lib > to $ENV{PATH} before executing the tests? Yes. ${libdir} points to F<../../blib/lib>, but on Windows the DLL is put into the root directory, like F<miniparrot.exe> or F<parrot.exe>. Not sure about other platforms. So F<../..> would do for Windows. >> Step 2 is the hard part, and I'd like to ask for some advice. The flags >> seem to come from F<parrot.pc>, generated from the input file >> F<config/gen/makefiles/parrot.pc.in>. The relevant entries are: >> >> Libs: -L${libdir} -lparrot >> Cflags: -I${includedir} >> >> The C<Cflags> seem to be added correctly in Module::Build (version >> 0.2805) to the C<extra_compiler_flags>, but they don't get passed to the >> compiler. I needed to change C<incpath> for this. This seems to be an >> issue with Module::Build, but I need to double check this. > > Is C<incpath> a separate M::B option for Win32? I have to admit I just hacked F<_build/build_params> to get P::E compiled. I'm not sure where C<incpath> is coming from. On my box it says: 'incpath' => '\\include' I'll have to keep searching for this. C<extra_compiler_flags> is: 'extra_compiler_flags' => [ '-I/usr/local/include', '-I..\\..\\include' ], But I don't see them during the call to the compiler. > >> Second, C<Libs> is not right for Visual C++ (but added to >> C<extra_linker_flags> and passed to the linker.) >> >> F<config/gen/makefiles/parrot.pc.in> says: >> >> Libs: -L${libdir} -lparrot @icu_shared@ @libs@ >> >> Visual C++ needs: >> >> ${libdir}/libparrot.lib @icu_shared@ @libs@ >> or >> /LIBPATH:${libdir} libparrot.lib @icu_shared@ @libs@ >> >> Any recommended way to get there? > > > Does pkg-config work on Windows? If not, modifying that file is rather moot, > and Parrot::Embed can work another way. Another option is to use > Parrot::Config, if that'll be available and installed. That might be a > better option. > > I'm open to ideas. Sorry, no pkg-config here. Not sure if there are other toolkits, like MinGW or Cygwin, that are providing it. I'm not a Linux/UNIX regular, is F<parrot.pc> used by this tool? The file is parsed directly by P::E's Build.PL, so I thought it's just a random format. Just thinking loud here, but even if there isn't a pkg-config on Windows we could reuse the file. C<parrot.pc> is generated by Configure using the template F<config/gen/makefiles/parrot.pc.in>. One way I can see would be to put the parrot library options into a variable, like this: Libs: @libparrot_shared@ @icu_shared@ @libs@ with @libparrot_shared@ == "-L${libdir} -lparrot" on GCC (not sure where else, too) and @libparrot_shared@ == "${libdir}/libparrot.lib" on VC. Another way would be to template all of C<parrot.pc.in>, by adding C<vc_parrot.pc.in>, and select the right template during source generation. In my opinion Parrot::Config is probably not the best way to handle this. The paths are relative and not expanded, for example: 'cc_inc' => '-I./include', 'libparrot' => '$(LIBPARROT_SHARED)', 'libparrot_ldflags' => 'libparrot$(A)', 'libparrot_shared' => 'libparrot$(SHARE_EXT)', I guess P::C is more for introspection how Parrot was built, not how to build an extension. Maybe it would be enough to come up with some platform specific search code for Windows in P::C's Build.PL. After all, everything we need is the library and the headers. I'm wondering how other Perl modules handle this... Any thoughts are greatly appreciated, Ron