Hi, my friends, can you help me to build a modules in win32(activeperl5.6.0).
I have some problems when comiling a modules named "Createxls".
#the first step:
c:\>h2xs -A -n Createxls
#the second: rewrite some files related: Makefile.PL, Createxls.xs, and add a sub
modules' file to directory named "authslt"
the file list:
└─Createxls
├─authslt
Createxls.pm
README
test.pl
Changes
MANIFEST
authslt <DIR>
Createxls.xs
Makefile.PL (1)
the DIR authslt:
InfFile.cpp (with a class named "CInfFile")
InfFile.h
Makefile.PL (2)
################################ some file list
###########################################################
# file list Makefile.PL (1)
# Makefile.PL (1)
use ExtUtils::MakeMaker;
# See lib/ExtUtils/MakeMaker.pm for details of how to influence
# the contents of the Makefile that is written.
WriteMakefile(
'NAME' => 'Createxls',
'VERSION_FROM' => 'Createxls.pm', # finds $VERSION
'PREREQ_PM' => {}, # e.g., Module::Name => 1.1
($] >= 5.005 ? ## Add these new keywords supported since 5.005
(ABSTRACT_FROM => 'Createxls.pm', # retrieve abstract from module
AUTHOR => 'A. U. Thor <[EMAIL PROTECTED]>') : ()),
'LIBS' => [''], # e.g., '-lm'
'DEFINE' => '', # e.g., '-DHAVE_SOMETHING'
# Insert -I. if you add *.h files later:
'INC' => '-I./authslt', # e.g., '-I/usr/include/other'
# Un-comment this if you add C files to link with later:
# 'OBJECT' => '$(O_FILES)', # link all the C files too
'MYEXTLIB' => 'authslt/InfFile.lib',
#'CC' => 'g++', #when
dmake this option to work
#'LD' => 'g++', #when dmake this option to work
#'CCDLFLAGS' => '-rdynamic -shared -usave_log', #when dmake this
option to work
);
sub MY::postamble {
'
$(MYEXTLIB): authslt/Makefile
cd authslt && $(MAKE) $(PASSTHRU)
';
}
##########################################################################################################
# file list Makefile.PL (2)
# Makefile.PL (2)
use ExtUtils::MakeMaker;
$Verbose = 1;
WriteMakefile(
NAME => 'Createxls::authslt',
SKIP => [qw(all static static_lib dynamic dynamic_lib)],
clean => {'FILES' => 'InfFile.lib'},
#'CC' => 'g++', #when
dmake this option to work
#'LD' => 'g++', #when dmake this option to
work
#'CCDLFLAGS' => '-rdynamic -shared -usave_log', #when dmake this option
to work
);
sub MY::top_targets {
'
all : static
pure_all : static
static : libmylib$(LIB_EXT)
libmylib$(LIB_EXT): $(O_FILES)
#when nmake # rem only in this
help mail
$(AR) InfFile.o
#when dmake # rem only in this help mail
$(AR) -rc InfFile.lib InfFile.obj
$(RANLIB) InfFile.lib
';
}
##########################################################################################################
# file list Createxls.xs
# Createxls.xs
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
#include ".\\authslt\\InfFile.h"
#define InfFileSize 2048
/*
CInfFile *cInfFile
cInfFile.SetInfFileSize(InfFileSize)
*/
static int
not_here(char *s)
{
croak("%s not implemented on this architecture", s);
return -1;
}
static double
constant(char *name, int len, int arg)
{
errno = 0;
if (strEQ(name + 0, "TESTVAL")) { /* removed */
#ifdef TESTVAL
return TESTVAL;
#else
errno = ENOENT;
return 0;
#endif
}
errno = EINVAL;
return 0;
}
MODULE = Createxls PACKAGE = Createxls
CInfFile *
CInfFile::new()
void
CInfFile::SetInfFileSize(lInfFileSize)
unsigned long lInfFileSize
long
CInfFile::GetInfFileSize()
long
CInfFile::SaveInformation(szInfFileName, szInformation)
char* szInfFileName
char* szInformation
long
CInfFile::GetInformation(szInfFileName, szInf, dwInfLen)
const char * szInfFileName
char* szInf
unsigned long * dwInfLen
void
CInfFile::DESTROY()
####################################################################################################
# file list InfFile.h
#InfFile.h
#ifndef INFFILE_H_
#define INFFILE_H_
#include <string.h>
//#ifndef _WIN32
//type redefine
#define BYTE unsigned char
#define TCHAR char
//#define __int32 int32_t
#define DWORD unsigned long
#define LPCTSTR const char*
#define LPTSTR char *
//function redefine
#define _tcscat strcat
#define _tcscpy strcpy
#define _tcsdup strdup
#define _tcslen strlen
#define _tfopen fopen
//#endif
class CInfFile
{
public:
CInfFile();
~CInfFile();
private:
unsigned long m_lInfFileSize;
public:
void SetInfFileSize(unsigned long lInfFileSize) { m_lInfFileSize =
lInfFileSize; }
unsigned long GetInfFileSize() { return m_lInfFileSize; }
long SaveInformation(LPCTSTR szInfFileName, LPCTSTR szInformation);
long GetInformation(LPCTSTR szInfFileName, LPTSTR szInf, DWORD
*dwInfLen);
};
#endif
############################## File list end
#######################################################
#the third: comile
I have two enviroment in my system, visual C++ 6.0 and gcc(mingW 3.0.1 gcc 3.0 dmake
4.1)
because the default enviroment of Config.pm in activeperl is for nmake, so I change
the file \perl\lib\Config.pm
bye alter some options and some values:
ld='link'
make='dmake'
ranlib='ranlib'
ar='ar'
-machine:x86 => -i386pe
a. visual C++, nmake
change the \perl\lib\Config.pm
now: CC = cl.exe, ar = lib , ranlib = rem
c:\>perl Makefile.PL
MakeMaker (v5.45)
Warning (non-fatal): Target 'dynamic' depends on targets in skipped section
'dynamic_lib'
Warning (non-fatal): Target 'static' depends on targets in skipped section 'static_lib'
Writing Makefile for Createxls::authslt
Writing Makefile for Createxls
c:\>nmake
........
lib InfFile.o
rem InfFile.lib # got this file
.........
cl -c -I./authslt -nologo -O1 -MD -DNDEBUG -DWIN32 -D_CONSOLE -DNO_STRICT
-DHAVE_DES_FCRYP
-DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DPERL_MSVCRT_READFIX -O1 -MD -DNDEBUG
-DVERSION=\"
01\" -DXS_VERSION=\"0.01\" -ID:\Perl\lib\CORE Createxls.c
Createxls.c
.\\authslt\\InfFile.h(25) : error C2061: syntax error : identifier 'CInfFile'
.\\authslt\\InfFile.h(25) : error C2059: syntax error : ';'
.\\authslt\\InfFile.h(26) : error C2449: found '{' at file scope (missing function
header?)
.\\authslt\\InfFile.h(41) : error C2059: syntax error : '}'
Createxls.c(55) : error C2065: 'CInfFile' : undeclared identifier
Createxls.c(55) : error C2065: 'RETVAL' : undeclared identifier
Createxls.c(55) : warning C4552: '*' : operator has no effect; expected operator with
side-effect
......(errors related)
b. gcc , dmake
change the \perl\lib\Config.pm
CC = g++, ar = ar , ranlib = ranlib
c:\>perl Makefile.PL
MakeMaker (v5.45)
Warning (non-fatal): Target 'dynamic' depends on targets in skipped section
'dynamic_lib'
Warning (non-fatal): Target 'static' depends on targets in skipped section 'static_lib'
Writing Makefile for Createxls::authslt
Writing Makefile for Createxls
c:\>dmake
........
ar -rc InfFile.lib InfFile.o
ranlib InfFile.lib # got this file
.........
g++ -c -I./authslt -nologo -O1 -MD -DNDEBUG -DWIN32 -D_CONSOLE -DNO_STRICT
-DHAVE_DES_FCRYPT -DPERL_
IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DPERL_MSVCRT_READFIX -O1 -MD -DNDEBUG
-DVERSION=\"0.01\"
-DXS_VERSION=\"0.01\" -ID:\Perl\lib\CORE Createxls.c
g++: unrecognized option `-nologo'
"Running Mkbootstrap for Createxls ()"
D:\Perl\bin\perl.exe -ID:\Perl\lib -ID:\Perl\lib -MExtUtils::Command -e chmod 644
Createxls.bs
D:\Perl\bin\perl.exe "-ID:\Perl\lib" "-ID:\Perl\lib" -MExtUtils::Mksymlists \
-e "Mksymlists('NAME' => 'Createxls', 'DLBASE' => 'Createxls', 'DL_FUNCS' => {
}, 'FUNCLIST' =
> [], 'IMPORTS' => { }, 'DL_VARS' => []);"
ld -out:blib\arch\auto\Createxls\Createxls.dll -dll -nologo -nodefaultlib -release
-libpath:"D:/Per
l\lib\CORE" -i386pe Createxls.obj authslt/InfFile.lib D:\Perl\lib\CORE\perl56.lib
oldnames.lib ker
nel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib
ole32.lib oleaut3
2.lib netapi32.lib uuid.lib wsock32.lib mpr.lib winmm.lib version.lib odbc32.lib
odbccp32.lib msvc
rt.lib -def:Createxls.def
ld: bad -rpath option
dmake.exe: Error code 1, while making 'blib\arch\auto\Createxls\Createxls.dll'
##------------------------
can you help me to build this modules or give me some advices ? Thanks a lot
cron
[EMAIL PROTECTED]
2004-02-10
_______________________________________________
Perl-Unix-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs