pocket newLISP.DLL possible ?

Started by HPW, August 24, 2004, 02:00:18 PM

Previous topic - Next topic

HPW

Reposted from PocketGCC-forum:


Quote
After getting newLISP.EXE running, another option would be to

get a newLISP.DLL working on PocketPC.



Can PocketGCC compile such a DLL ?



Can Harry Konstas PCForms-converter be used to build programms with

Alexander compiler? (He used the first one from Vitaliy)



So would it be possible to build C-programms with this tools

and call a newLISP.DLL exported function from them?



Hans-Peter


Does a C-Frontend with newLISP.DLL make sense on Pocket-PC?

Surly in terms of programm-size and speed.

Of cource it has the same static approach as delphi,powerbasic and purebaisc on windows.
Hans-Peter

Lutz

#1
The best would probably be to do some kind of frontend with an existing PPC application, which either can import newlisp.dll (and I don't know if it is possible to make one with the arm-wince-pe tools) or talk to newlisp.exe in -p mode like the newLISP-tk frontend does.



How does Luis currently operate it. Is there some kind of command shell on the PPC?



Lutz

HPW

#2
Alexanders answer:


Quote
From:  "Alexander M." <mamaich@u...>

Date:  Wed Aug 25, 2004  12:40 am

Subject:  Re: newLISP.DLL compile possible ?



 

> After getting newLISP.EXE running, another option would be to

> get a newLISP.DLL working on PocketPC.

>

> Can PocketGCC compile such a DLL ?



Cygwin version of compiler can produce DLLs like this:

gcc testdll.cpp --shared -otestdll.dll -Wl,--out-implib -Wl,libtestdll.a



This would export all "__declspec(dllexport)" symbols or symbols

present in .DEF file. Currently this feature is a bit untested and may

cause problems when exporting C++ symbols that use name mangling. And

use "-staticlibs" switch to compile your DLL. There is one known

problem. If both DLL and EXE use console output, the EXE file should

output some text before DLL (i.e. the console should be initialised by

EXE file and not DLL). Otherwise PocketPC may hang on program exit. I

think that this is a problem in console driver, as it is also present

in eVC programs that use DLLs.



For some reason standart "configure" scripts think that

compiler/linker does not support shared libraries. I never had time to

fix that.



> Can Harry Konstas PCForms-converter be used to build programms with

> Alexander compiler? (He used the first one from Vitaliy)



I have never seen this program.



> So would it be possible to build C-programms with this tools

> and call a newLISP.DLL exported function from them?





This is possible, at least you can manually build a DLL from a library

file like I do when building LIBC.DLL


>or talk to newlisp.exe in -p mode like the newLISP-tk frontend does.



This would ne the first I want to investigate as soon I have some PPC Hardware. The first try would be Tcl/Tk for pocket  to work in the same way as on windows.



>Is there some kind of command shell on the PPC?



Besides the MS Console/CMD Alexander mentioned the tools from here:



http://www.symbolictools.de/public/pocketconsole/index.htm">http://www.symbolictools.de/public/pock ... /index.htm">http://www.symbolictools.de/public/pocketconsole/index.htm

http://www.symbolictools.de/public/pocketconsole/applications/PocketCMD/index.htm">http://www.symbolictools.de/public/pock ... /index.htm">http://www.symbolictools.de/public/pocketconsole/applications/PocketCMD/index.htm
Hans-Peter

Lutz

#3
I have put a 'win32dll.c'  with appropiate #ifdefs for WinCE DLLs in to http://newlisp.org/downloads/development/WinCE/">http://newlisp.org/downloads/development/WinCE/ including also a makefile_wincedll , which compiles without warnings but does not link, the --shared option is not recognized and I am not sure if there are any other problems on the link line.



There is also a new newlisp.c which should be used. Note that now all stuff moved into download/development/WinCE , download/WinCE only contains the executable.



The linker error messages coming up look trivial and just seem to indicate a wrong formed linker line.



Thanks to all involved



Lutz

HPW

#4
QuoteFrom:  "Alexander M." <mamaich@u...>

Date:  Thu Aug 26, 2004  1:02 am

Subject:  Re: newLISP.DLL compile possible ?

 

> I have put a 'win32dll.c' with appropiate #ifdefs for WinCE DLLs in

> to http://newlisp.org/downloads/development/WinCE/">http://newlisp.org/downloads/development/WinCE/ including also a

> makefile_wincedll , which compiles without warnings but does not

> link, the --shared option is not recognized and I am not sure if

> there are any other problems on the link line.



The "--shared" command line option was added in the "specs" file fix.

For older versions it was "-target=dll".
Hans-Peter

Lutz

#5
thanks, but I still get the same error message:



~/newlisp-8.1.5> make -f makefile_wincedll

arm-wince-pe-gcc -target=dll  -staticlibs newlisp.o nl-symbol.o nl-math.o nl-list.o nl-liststr.o nl-string.o nl-filesys.o nl-soc

k.o nl-import.o nl-xml.o nl-web.o nl-matrix.o nl-debug.o pcre.o win32-util.o win32dll.o -onewlisp.dll -Wl, --out-implib -Wl

/usr/local/lib/gcc-lib/arm-wince-pe/3.3.3/../../../../arm-wince-pe/bin/ld: cannot open : No such file or directory

collect2: ld returned 1 exit status

make: *** [default] Error 1

~/newlisp-8.1.5>



the program ld is clearly existent in my installation, and it does not complain when linking for the normal newlisp.exe



I am also confused about what files I need from Alexanders website, I thoght that arm-wince-pe.rar is enough, and it is so for making the .exe, what is the 'spec' file?



I have put and updated makefile_wincedll in the development/WinCE directory.



Lutz

HPW

#6
I have reposted your answer in http://groups.yahoo.com/group/pocketgcc/">http://groups.yahoo.com/group/pocketgcc/



From:



http://mamaich.kasone.com/fr_pocket.htm">http://mamaich.kasone.com/fr_pocket.htm



specs.rar

2843 bytes

Another update. Fixes a bug that main() function cannot be located by linker if it is inside a library file. In this case you should specify "-target=con" or "-mconsole" GCC switch. Installation instructions are in archive.





There are also other update-files.
Hans-Peter

HPW

#7
From:  "Alexander M." <mamaich@u...>

Date:  Fri Aug 27, 2004  12:16 am

Subject:  Re: newLISP.DLL compile possible ?



Your command line is indomplete:

>... util.o win32dll.o -onewlisp.dll -Wl, --out-implib -Wl



These "-Wl" instruct LD to produce import library, but you have

specified an empty name for it. The corect syntax should be:

... util.o win32dll.o -onewlisp.dll -Wl,--out-implib -Wl,libnewlisp.a





> I am also confused about what files I need from Alexanders website, I

> thoght that arm-wince-pe.rar is enough, and it is so for making

> the .exe, what is the 'spec' file?





You should: "first install libcfix.rar, then libcfix1.rar, then

specs.rar". This should be done after installing the "arm-wince-pe.rar".

I'm working on an update and will later upload a complete package.
Hans-Peter

HPW

#8
Answer for another question I post on PocketGCC:



From:  "Alexander M." <mamaich@u...>

Date:  Fri Aug 27, 2004  12:18 am

Subject:  Re: ActiveX-DLL's possible with PocketGCC?



 

> For integration in other enviroments, it would be handy to be able to

> compile the newLISP.DLL as an ActiveX control. Is this possible?



You should test that. I think that PocketPC GCC is compatible with COM.



End post

 

I asked this because most dev-enviroment on pocket seems to support this per default. So it would be interesting.
Hans-Peter

Lutz

#9
Thanks for your recommendations, but if I do this:

... -onewlisp.dll -Wl,--out-implib -Wl,libnewlisp.a



I get:  "... libnewlisp.a: No such file or directory"



I had the best results with leaving out the implib stuff completely and doing:



$(CC) -target=dll -staticlibs $(OBJS) -onewlisp.dll



in the make file but then I get an error about "multiple definition of 'environ' defined in 'libc.a' alreadyy defined in 'collect2'.



Somewhere in the libraries it seems to be double defined?



Is there any documentation about the compile/ling flags I can use?



For the pocketpc stuff to be permanent part of the distribution, I need more developed tools. The best would be an archive/installer with a version number and a minimum of documentaion for compile/link flags.



The way it works (or not works :-) ) at the moment is an endless fiddleing without really knowing what I am doing.



I will let the PocketPC project sleep for a while until Alexander releases a new compiler package and somebody (HPW ?) is avalalable for testing.



Lutz

HPW

#10
>and somebody (HPW ?) is available for testing.



As soon as I can!

Still searching hardware and saving money for it!



;-(
Hans-Peter

HPW

#11
From:  "Alexander M." <mamaich@u...>

Date:  Mon Aug 30, 2004  12:30 am

Subject:  Re: newLISP.DLL compile possible ?



> I had the best results with leaving out the implib stuff completely

> and doing:

>

> $(CC) -target=dll -staticlibs $(OBJS) -onewlisp.dll

>

> in the make file but then I get an error about "multiple definition

> of 'environ' defined in 'libc.a' alreadyy defined in 'collect2'.



something strange. There is no "collect2" library. "collect2" is an

executable internally used by GCC. Can you post the full error message?



> Is there any documentaion about the compile/ling flags I can use?



There is no documentation. You may look into GCC source code or

"specs" file. The PocketPC-specific flags are "-staticlibs",

"-target=" and "--shared". All other parameters are the same as in

Windows GCC.



End yahoo



Answer for another question from me:



From:  "Alexander M." <mamaich@u...>

Date:  Mon Aug 30, 2004  12:26 am

Subject:  Re: ZIP/UNZIP.DLL from InfoZip possible?



 

> When it will be possible to compile DLL's

> this would be also something nice to have:

>

> http://www.info-zip.org">http://www.info-zip.org



It is possible to create DLLs. For example I've made unrar.dll for myself.

 

End yahoo





From Alexander's pocketpage:



http://mamaich.kasone.com/fr_pocket.htm">http://mamaich.kasone.com/fr_pocket.htm



http://mamaich.kasone.com/ppc/src.otfunrar.rar">http://mamaich.kasone.com/ppc/src.otfunrar.rar

199739 bytes

unrar3.dll sources, which is used for "on-the-fly" decompression of RAR archives



http://mamaich.kasone.com/ppc/src.unrar.rar">http://mamaich.kasone.com/ppc/src.unrar.rar

105928 bytes

Modified unrar.dll sources. Use "make lib" to compile unrar.a
Hans-Peter

Lutz

#12
Thanks for the pointers, here is the complete error message for Alexander:



.o nl-import.o nl-xml.o nl-web.o nl-matrix.o nl-debug.o pcre.o win32-util.o win32dll.o -onewlisp.dll

/usr/local/lib/gcc-lib/arm-wince-pe/3.3.3/../../../../arm-wince-pe/lib/libc.a(startup.o)(.data+0x0): multiple definition of `environ'

/usr/local/lib/gcc-lib/arm-wince-pe/3.3.3/../../../../arm-wince-pe/lib/libc.a(environ.o)(.data+0x0): first defined here

collect2: ld returned 1 exit status

make: *** [default] Error 1



>>> Alexander >>>

something strange. There is no "collect2" library. "collect2" is an

executable internally used by GCC. Can you post the full error message?

>>>



'environ' is used by GCC and exposed to the compiler user in 'unistd.h'. The error message seems to indicate that the double definition is in the startup code in: 'startup.o', there is probably a different 'startup.c' for every compile flavor/target = win/con/dll, looking into those will reveal the problem, perhaps just a forgotten 'extern' keyword.



Lutz

HPW

#13
From:  "Alexander M." <mamaich@u...>

Date:  Tue Aug 31, 2004  12:16 am

Subject:  Re: newLISP.DLL compile possible ?



 

> ...

> 'environ' is used by GCC and exposed to the compiler user

> in 'unistd.h'. The error message seems to indicate that the double

> definition is in the startup code in: 'startup.o', there is probably

> a different 'startup.c' for every compile flavor/target =

> win/con/dll, looking into those will reveal the problem, perhaps just

> a forgotten 'extern' keyword.



Yes, I've forgot to remove environ.o file from libc.a. You may delete

it yourself with the command:

ar.exe -d libc.a environ.o

or I'll later modify libc and upload it to my site.
Hans-Peter

Lutz

#14
I did:



ar.exe -d libc.a environ.o



but then I got:



arm-wince-pe-gcc -target=dll -staticlibs newlisp.o nl-symbol.o nl-math.o nl-list.o nl-liststr.o nl-string.o nl-filesys.o nl-sock

.o nl-import.o nl-xml.o nl-web.o nl-matrix.o nl-debug.o pcre.o win32-util.o win32dll.o -onewlisp.dll

/usr/local/lib/gcc-lib/arm-wince-pe/3.3.3/../../../../arm-wince-pe/lib/libc.a: could not read symbols: Archive has no index; run

 ranlib to add one

collect2: ld returned 1 exit status



I then did:



ranlib libc.a



but still get the same errormessage as above. I also tried:



ar -s libc.a



but still the library gets reported with no index



Lutz