pocket newLISP.DLL possible ?

Machine-specific discussion
Unix, Linux, OS X, OS/2, Windows, ..?
Locked
HPW
Posts: 1390
Joined: Thu Sep 26, 2002 9:15 am
Location: Germany
Contact:

pocket newLISP.DLL possible ?

Post by HPW »

Reposted from PocketGCC-forum:
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
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Post by Lutz »

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
Posts: 1390
Joined: Thu Sep 26, 2002 9:15 am
Location: Germany
Contact:

Post by HPW »

Alexanders answer:
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/pock ... /index.htm
http://www.symbolictools.de/public/pock ... /index.htm
Hans-Peter

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Post by Lutz »

I have put a 'win32dll.c' with appropiate #ifdefs for WinCE DLLs in to 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
Posts: 1390
Joined: Thu Sep 26, 2002 9:15 am
Location: Germany
Contact:

Post by HPW »

From: "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/ 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
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Post by Lutz »

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
Posts: 1390
Joined: Thu Sep 26, 2002 9:15 am
Location: Germany
Contact:

Post by HPW »

I have reposted your answer in http://groups.yahoo.com/group/pocketgcc/

From:

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
Posts: 1390
Joined: Thu Sep 26, 2002 9:15 am
Location: Germany
Contact:

Post by HPW »

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
Posts: 1390
Joined: Thu Sep 26, 2002 9:15 am
Location: Germany
Contact:

Post by HPW »

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
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Post by Lutz »

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
Last edited by Lutz on Fri Aug 27, 2004 1:10 pm, edited 1 time in total.

HPW
Posts: 1390
Joined: Thu Sep 26, 2002 9:15 am
Location: Germany
Contact:

Post by HPW »

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

As soon as I can!
Still searching hardware and saving money for it!

;-(
Hans-Peter

HPW
Posts: 1390
Joined: Thu Sep 26, 2002 9:15 am
Location: Germany
Contact:

Post by HPW »

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

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/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
105928 bytes
Modified unrar.dll sources. Use "make lib" to compile unrar.a
Hans-Peter

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Post by Lutz »

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
Posts: 1390
Joined: Thu Sep 26, 2002 9:15 am
Location: Germany
Contact:

Post by HPW »

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
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Post by Lutz »

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

HPW
Posts: 1390
Joined: Thu Sep 26, 2002 9:15 am
Location: Germany
Contact:

Post by HPW »

From: "Alexander M." <mamaich@u...>
Date: Thu Sep 2, 2004 12:00 am
Subject: Re: newLISP.DLL compile possible ?


> 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

You get the ranlib error when you use x86 version of AR. Use
arm-wince-pe-ar.exe to produce correct file.
Hans-Peter

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Post by Lutz »

Thanks to Alexander for advice and thanks to Hans-Peter for the relay. A newlisp.dll is in http://newlisp.org/downloads/development/WinCE/ ready for testing (based on newLISP v.8.1.5)

I will post newLISP development version 8.1.5 with the multicasting stuff, fixes for BSD and Solaris and makefiles for WinCE/DLL tomorrow.

Lutz

HPW
Posts: 1390
Joined: Thu Sep 26, 2002 9:15 am
Location: Germany
Contact:

Post by HPW »

Lutz,

Thanks for the new platform!
Still in research for the pocket hardware.
(So much new stuff get into market like VGA-resolution
and Intel's GPU 2700g, Hard to make a choice)


And good luck with hurricane Francis over the weekend!
Hans-Peter

HPW
Posts: 1390
Joined: Thu Sep 26, 2002 9:15 am
Location: Germany
Contact:

Post by HPW »

A happy new year to all newLISP'er.

Still no Pocket-hardware in the new year (Seems that Santa Claus miss my wish) ;-)
But I hope to get something this year.

In the meantime someone on the PocketGCC group talk about another compiler option for Pocket PC.

http://smorgasbordet.com/pellesc/

Seems to be a bit better supported platform on a first look. (But no info about any GCC compatibility)
Since I am not a C-Programmer, I does not know if it would be possible to compile newLISP with it. But maybe it is worth a second look.
Hans-Peter

HPW
Posts: 1390
Joined: Thu Sep 26, 2002 9:15 am
Location: Germany
Contact:

Post by HPW »

On my question on Pelle C forum:
I will try to find some time to check it out - if the sources use 'standard C' (not C++ or GCC extensions) I can see no reason why it shouldn't work.

Pelle
Hans-Peter

HPW
Posts: 1390
Joined: Thu Sep 26, 2002 9:15 am
Location: Germany
Contact:

Post by HPW »

Hello again,

I have looked some more on this.

At least so far, I have limited Pelles C to standard C, with some Microsoft extensions. A fairly common extension/different standard is "POSIX". It seems that the sources uses it (dirent.h, unistd.h and so on).

Adding the missing declarations (and functions!) is doable, but require some work (possibly even much work). It would be nice to add at least some of the missing stuff, but maybe not all - and it will probably take some time. At the moment, I don't see an *easy* solution...

Pelle
Seems that we have to use what we have so far!
;-)
Hans-Peter

Locked