Hi, I'm trying to port pdlib (http://gitorious.org/pdlib/libpd) to Java using Cibyl (http://code.google.com/p/cibyl/) so that I can use pdlib on Blackberry devices. You can see the project at https://github.com/appsfactory/jlibpd if you like. I've also been keeping a log of my progress on a GitHub wiki page at https://github.com/appsfactory/jlibpd/wiki/Cibyl-Log.
I've been successful in compiling most of it to intermediate MIPS code (which Cibyl then translates to Java byte code), however there are two c library files that are not implemented in the Cibyl toolchain (dlfcn.h and socket.h).
There are three files in pure data that link to these two: socket.h: s_inter.c and x_net.c dlfcn.h: s_loader.c
I have two options for getting around this. I could either:
use Cibyl to link to these (example: https://github.com/SimonKagstrom/cibyl/tree/master/examples/host-java/export...), OR 2. Port libpd without using these headers.
So, since it's not exactly ideal to re-implement these headers in Java (I don't even know if it's possible), is there a way that I can pull these files out of the pure data project? I'm not entirely sure what they do, or how essential/core they are to the project. Can I just remove certain (unneeded?) functionality?
Another option is to rewrite these files so that they don't use socket.h or dlfcn.h. I don't know how possible that is either. I thought that before I dive in and start figuring out the whole project structure and what each of the files do, I should see if anyone that already knows could fill me in on the feasibility of this...
Thanks, -Andrew
On Wed, 27 Jul 2011, Andrew VanderVeen wrote:
So, since it's not exactly ideal to re-implement these headers in Java (I don't even know if it's possible), is there a way that I can pull these files out of the pure data project? I'm not entirely sure what they do, or how essential/core they are to the project. Can I just remove certain (unneeded?) functionality?
No <dlfcn.h> means no externals except by explicit linkage.
No <socket.h> means no gui, no [netsend] and no [netreceive].
| Mathieu Bouchard ---- tél: +1.514.383.3801 ---- Villeray, Montréal, QC
In terms of feasibility, most of Pd is really plain C, so it should be
an easy port. The only things that are not are the various I/O
methods (audio, midi, files, net, etc). You'll need to write a audio
I/O driver, that'll probably be in Java. You can look at the Android
port for an example. libpd talks to the Java audio I/O via a JNI lib.
On Jul 27, 2011, at 2:28 PM, Mathieu Bouchard wrote:
On Wed, 27 Jul 2011, Andrew VanderVeen wrote:
So, since it's not exactly ideal to re-implement these headers in
Java (I don't even know if it's possible), is there a way that I
can pull these files out of the pure data project? I'm not
entirely sure what they do, or how essential/core they are to the
project. Can I just remove certain (unneeded?) functionality?No <dlfcn.h> means no externals except by explicit linkage.
Yeah, basically, if you want to add extra objects, then'll need to be
compiled and linked in before processing with cibyl. You can ignore
that stuff to get things working, indeed the iOS version does not use
it at all. Then later you can figure out how to include external
objects if need be.
No <socket.h> means no gui, no [netsend] and no [netreceive].
Since you're most interested in the libpd approach, then you don't
need to worry about the socket for the GUI. That you can skip.
Indeed that's the normal way with libpd. As for [netsend] and
[netreceive], those are a way
.hc
Programs should be written for people to read, and only incidentally
for machines to execute.
On Wed, 27 Jul 2011, Hans-Christoph Steiner wrote:
Since you're most interested in the libpd approach, then you don't need to worry about the socket for the GUI. That you can skip. Indeed that's the normal way with libpd. As for [netsend] and [netreceive], those are a way
please finish sentence...
| Mathieu Bouchard ---- tél: +1.514.383.3801 ---- Villeray, Montréal, QC
On Jul 27, 2011, at 5:32 PM, Mathieu Bouchard wrote:
On Wed, 27 Jul 2011, Hans-Christoph Steiner wrote:
Since you're most interested in the libpd approach, then you don't
need to worry about the socket for the GUI. That you can skip.
Indeed that's the normal way with libpd. As for [netsend] and
[netreceive], those are a wayplease finish sentence...
sorry, haven't slept much recently... those are a way to connect to
other apps? I forget...
.hc
Programs should be written for people to read, and only incidentally
for machines to execute.
Yep, I'm already working with libpd. I've removed x_net and s_loader, and chopped out the sections of s_inter that deal with sockets. Everything compiles to .o files just fine now (with Cibyl's libc), but I'm having trouble at the linking step. I'm not sure that this is a pd-related issue at this point (I don't think it is) since I think I've made the necessary modifications to pd, so I can direct my questions elsewhere.
If anyone is interested, though, you can see my progress here (with output from GCC): https://github.com/appsfactory/jlibpd/wiki/Cibyl-Log and the Makefile for the project here: https://github.com/appsfactory/jlibpd/blob/master/Makefile
If you have any suggestions or help, it would be appreciated. However, it's pretty unrelated to pd at this point, so don't worry about it unless you're interested in the port.
Thanks for all the help guys! -Andrew
On Wed, Jul 27, 2011 at 5:54 PM, Hans-Christoph Steiner hans@at.or.atwrote:
On Jul 27, 2011, at 5:32 PM, Mathieu Bouchard wrote:
On Wed, 27 Jul 2011, Hans-Christoph Steiner wrote:
Since you're most interested in the libpd approach, then you don't need
to worry about the socket for the GUI. That you can skip. Indeed that's the normal way with libpd. As for [netsend] and [netreceive], those are a way
please finish sentence...
sorry, haven't slept much recently... those are a way to connect to other apps? I forget...
.hc
------------------------------**------------------------------**
Programs should be written for people to read, and only incidentally for machines to execute.
- from Structure and Interpretation of Computer Programs
Glad to see there is progress, looking forward to the result :)
In your linking issue, looks like it can't find libm (pow, tan, etc),
pthreads, etc.
.hc
On Jul 28, 2011, at 4:49 PM, Andrew VanderVeen wrote:
Yep, I'm already working with libpd. I've removed x_net and
s_loader, and chopped out the sections of s_inter that deal with
sockets. Everything compiles to .o files just fine now (with
Cibyl's libc), but I'm having trouble at the linking step. I'm not
sure that this is a pd-related issue at this point (I don't think it
is) since I think I've made the necessary modifications to pd, so I
can direct my questions elsewhere.If anyone is interested, though, you can see my progress here (with
output from GCC): https://github.com/appsfactory/jlibpd/wiki/Cibyl- Log and the Makefile for the project here: https://github.com/appsfactory/jlibpd/blob/master/MakefileIf you have any suggestions or help, it would be appreciated.
However, it's pretty unrelated to pd at this point, so don't worry
about it unless you're interested in the port.Thanks for all the help guys! -Andrew
On Wed, Jul 27, 2011 at 5:54 PM, Hans-Christoph Steiner
hans@at.or.at wrote:On Jul 27, 2011, at 5:32 PM, Mathieu Bouchard wrote:
On Wed, 27 Jul 2011, Hans-Christoph Steiner wrote:
Since you're most interested in the libpd approach, then you don't
need to worry about the socket for the GUI. That you can skip.
Indeed that's the normal way with libpd. As for [netsend] and
[netreceive], those are a wayplease finish sentence...
sorry, haven't slept much recently... those are a way to connect to
other apps? I forget....hc
Programs should be written for people to read, and only incidentally
for machines to execute.
- from Structure and Interpretation of Computer Programs
All mankind is of one author, and is one volume; when one man dies,
one chapter is not torn out of the book, but translated into a better
language; and every chapter must be so translated.... -John Donne
I am illiterate in this, but does this project (also from McCormick)
relates in any way to yours?