-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Randy Kobes Sent: Friday, March 25, 2005 12:46 PM To: Thompson, Lloyd D. (NSSD) Cc: Perl-Win32-Users@listserv.ActiveState.com Subject: Re: CROSSP: C::Scan doesn't work with my Activestate perl
On Fri, 25 Mar 2005, Thompson, Lloyd D. (NSSD) wrote: > Hello, > > I'm trying to use h2xs to create a perl interface to an existing c++ > api library. The first problem I had was C::Scan wasn't installed so > I installed it through ppm. > > Then C::Scan initially failed because cppstdin wasn't defined, so in > lib\Config.pm I changed cppstdin='' to cppstdin='cl -nologo -E'. > > Now my current problem is when I call h2xs with header file arguments > C::Scan executes my cppstdin statement but without a file argument. > The error I receive is 'cl : Command line error D2003 : missing source > filename'. Try the following patch against C::Scan: =================================================================== --- Scan.pm~ Thu Mar 23 09:14:18 2000 +++ Scan.pm Fri Mar 25 14:43:56 2005 @@ -831,6 +831,7 @@ use Symbol; use File::Basename; use Config; +use constant WIN32 => $^O eq 'MSWin32'; sub new { die "usage: C::Preprocessed->new(filename[, defines[, includes[, cpp]]])" @@ -844,7 +845,10 @@ $addincludes = "-I" . join(" -I", @$Includes) if defined $Includes and @$Includes; my($sym) = gensym; - my $cmd = "echo '\#include \"$filename\"' | $Cpp->{cppstdin} $Defines $addincludes $Cpp->{cppflags} $Cpp->{cppminus} |"; + my $cmd = WIN32 ? + "$Cpp->{cppstdin} $Defines $addincludes $Cpp->{cppflags} $filename |" : + "echo '\#include \"$filename\"' | $Cpp->{cppstdin} $Defines $addincludes $Cpp->{cppflags} $Cpp->{cppminus} |"; + #my $cmd = "echo '\#include \"$filename\"' | $Cpp->{cppstdin} + $Defines $addincludes $Cpp->{cppflags} $Cpp->{cppminus} |"; #my $cmd = "$Cpp->{cppstdin} $Defines $addincludes $Cpp->{cppflags} $Cpp->{cppminus} < $filename |"; #my $cmd = "echo '\#include <$filename>' | $Cpp->{cppstdin} $Defines $addincludes $Cpp->{cppflags} $Cpp->{cppminus} |"; ======================================================================= Does that work? It gets me past the 'cl : Command line error D2003 : missing source filename' error. I still have trouble getting it to output a filled in .xs file. I think it might have something to do with the dll prefixing of the function calls in the header file. LLSTATUS LLEXPORT LL_SessionAlloc( ... ) Where LLEXPORT is defined to be #if defined( _MSC_VER ) #define LLEXPORT __declspec( dllexport ) _stdcall #define LLCALLBACK #elif defined( __WIN32__ ) || defined( _WIN32 ) #define LLEXPORT _stdcall _export #define LLCALLBACK _stdcall _export #elif defined( __BORLANDC__ ) #define LLEXPORT _far _pascal _export #define LLCALLBACK _far _pascal _export #else #define LLEXPORT #define LLCALLBACK #endif The output of cl -E is LLSTATUS __declspec( dllexport ) _stdcall LL_SessionAllocEx( ... ) The output of g++ -E (cygwin) is LLSTATUS LL_SessionAlloc( ... ) I'm able to wrap the functions manually but I was hoping to have an automated process to parse through the header files of the library. Even if I use the .xs file output by h2xs run under cygwin I have to manually change all the header declarations to properly handle output parameters because none of the parameters are passed by reference (&) they are all passed as pointers to their respective types. Does anyone know of anyway to get around this problem? Lloyd _______________________________________________ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs