Article View: comp.lang.perl.misc
Article #72Trying to change perl.dll to a static library (for Perl compiler)
From: Jacob Williamson
Date: Thu, 10 Sep 1998 00:00
Date: Thu, 10 Sep 1998 00:00
96 lines
4441 bytes
4441 bytes
I'd like to know if I can make a static library version of perl.dll - if it's feasible or even possible. I've crossposted to Borland group, since this might only be a question of me not understanding how to make libraries, rather than something to do with perl; maybe my question is just "how do I make a static library instead of a dynamic library?", so anyone who knows about making libraries with Borland C++ but doesn't know anything about perl, don't hesitate to reply :) I've downloaded Malcolm Beattie's a3 Perl compiler for UNIX, and it works just fine under AIX. I've also downloaded Perl 5.005 beta 1, and have compiled it under Windows NT. The Perl compiler works great under NT as well (well done Malcolm!). However, the executable produced by the Perl compiler under AIX is standalone. However, under Windows NT, the executable also requires perl.dll to be present on the target machine. Can I make a "static" version of perl.dll? I think I have all the source code - after all I had to run a makefile to make perl.dll under NT. I am using Borland C++ 5.02 along with dmake, the free 'make' program (as it says in the Perl 5.005 README.win32). In makefile.mk, the relevant entries that makes perl.dll with Borland C++ are ********************* PERLDLL = ..\perl.dll LINK32 = tlink32 IMPLIB = implib -c LINK_FLAGS = -Ld:\work\bc5\lib $(PERLDLL): perldll.def $(PERLDLL_OBJ) $(LINK32) -Tpd -ap $(LINK_FLAGS) \ @$(mktmp c0d32$(o) $(PERLDLL_OBJ:s,\,\\)\n \ $@,\n \ $(LIBFILES)\n \ perldll.def\n) $(IMPLIB) $*.lib $@ ********************* I think that the above results in the commands tlink32 -Tpd -ap -Ld:\work\bc5\lib @C:\TEMP\mk000001 where mk000001 is a temporary file holding all Borland C++ .obj files to be linked in, and implib -c ..\perl.lib ..\perl.dll which makes an import library called perl.lib that refers to the entries in perl.dll . I tried to make a static version of perl.dll (and call it myperl.lib), by writing the following into makefile.mk: ************************* myperl.lib: $(PERLDLL_OBJ) tlib myperl.lib /P32 \ @$(mktmp $(PERLDLL_OBJ:s,\,\\,:^"+") $(LIBFILES:^"+d:\work\\\\bc5\lib\\")\n \ $@,\n) ************************* This runs a Borland C++ tlib command to make a static library: tlib myperl.lib /P32 +..\av.obj +..\byterun.obj ......... which links in all the .obj files and .lib files that are needed (the .lib files, i.e. $(LIBFILES), might not be needed here as they are linked later directly into the executable, but I can't get it to work either way). So I end up with a myperl.lib file which is supposedly my "static" version of the perl.dll file. Then, to create the final executable from a C source file like example.c, I run the cc_harness command as usual. When I use perl.dll, this produces the Borland C++ command: bcc32 -O2 -D_RTLDLL -DWIN32 -Ic:\perl5005beta1\5.00475\lib\MSWin32-x86/CORE -O2 example.c -LD:\work\bc5\lib c:\perl5005beta1\5.00475\lib\MSWin32-x86/CORE/perl.lib import32.lib cw32mti.lib odbc32.lib odbccp32.lib (The .lib files are those that I mentioned previously in my post in regards to $(LIBFILES). ) So if I want to use my myperl.lib, I put myperl.lib in the above command instead of perl.lib, and I also tried to remove the -D_RTLDLL (doesn't make a difference). It compiles with warnings, but when I use perl.dll, it compiled with similar warnings anyway. If I make the executable with perl.dll, it of course works. If I make it with myperl.lib instead, the executable just pauses for a second, then returns the prompt. So there are no obvious errors. Any suggestions?
Technical Details
Message-ID:
<35F718C0.496B830F@ibm.net>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f8d38,b32ad260c2000954,start X-Google-Attributes: gidf8d38,public X-Google-Thread: 10c066,b32ad260c2000954,start X-Google-Attributes: gid10c066,public X-Google-Thread: fa0ae,b32ad260c2000954,start X-Google-Attributes: gidfa0ae,public From: Jacob Williamson <jwillsp4m@ibm.net> Subject: Trying to change perl.dll to a static library (for Perl compiler) Date: 1998/09/10 Message-ID: <35F718C0.496B830F@ibm.net> X-Deja-AN: 389573956 Content-Transfer-Encoding: 7bit Organization: IBM Austin Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 Newsgroups: comp.lang.perl.misc,borland.public.cpp.commandlinetools,borland.public.cpp.language