Newton 2.0 API and ABI compatibility and D

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Newton 2.0 API and ABI compatibility and D

Postby predaeus » Wed Jan 21, 2009 11:35 am

I am developing using D (Digital Mars D) which is ABI (Application Binary Interface) compatible to C, meaning it can link to C libraries. Now http://en.wikipedia.org/wiki/Newton_Game_Dynamics states that Newton has a C API.

For testing I downloaded the current Newton 2.0 Open Beta linux 32bit package.

When trying to compile a C test application with "gcc -x c" I get several errors inside Newton.h. With "gcc -x c++" it compiles fine, which suggests that Newton is C++ with a non-object oriented API (pseudo C).

If I try to link against it with the D compiler it complains about C++ ABI references missing (because it does not support those).

Can you please clarify what API/ABI Newton has?

I can't seem to find any description of this in the documentation.
Last edited by predaeus on Wed Jan 21, 2009 1:25 pm, edited 1 time in total.
predaeus
 
Posts: 19
Joined: Wed Jan 21, 2009 10:49 am

Re: Newton 2.0 API and ABI compatibility

Postby ajung » Wed Jan 21, 2009 11:44 am

Coincidentally, I have put this Derelict wrapper hastily together just 2 days ago, but and it's not tested very well (there may be still "replace"-artefacts in it). Note, that I have no idea, whether this wrapper is compatible with the Newton license, since the original header is attributed "// copyright 2000-2004// By Julio Jerez", which - of course - is BS as the header is from 2009. Clarification would be nice concerning the legal usabiltiy of such selfmade wrapper :)

See the attached file.

Did you have trouble with the DerelictODE bindings as well? At least, that's why I'm here!

EDIT: Important! Windows tested only. The Linuxed-shared-library filenames are placeholders only!!!!!!!!!!!! You must plug in the actual linux shared library names!!!! Also note, it's DMD tested only, not GDC tested.
Attachments
newton_d.zip
(9.37 KiB) Downloaded 11629 times
ajung
 
Posts: 11
Joined: Sun Jan 18, 2009 8:22 am

Re: Newton 2.0 API and ABI compatibility

Postby predaeus » Wed Jan 21, 2009 12:01 pm

ajung let me invite you to http://www.dsource.org/forums/viewtopic ... 1452#21452 to try to get this into the Derelict trunk.

I'll ask Julio in the Beta 2.0 thread to provide shared libraries for Linux.
predaeus
 
Posts: 19
Joined: Wed Jan 21, 2009 10:49 am

Re: Newton 2.0 API and ABI compatibility

Postby ajung » Wed Jan 21, 2009 12:26 pm

My Derelit bindings can be considered "proof-of-concept".
I see several problems for an official Derelict release (yet):

1) Newton 2.0 is still in Beta phase, so the interface is likely to change in the future. This would imply, that the Derelict wrapper may be need to redone for each interface change (tracking the interace changes isn't easy either)
2) Currently, DerelictNewton is DMD 2.x tested only. Derelict itself is DMD 1.x the last time I checked. I for one use a "hacked" version of Derelict which works with DMD 2.x.
3) As I said, the licence issue must be resolved, i.e. whether such a wrapper is legal, and if yes, under which licence it is to place.
4) All "const" stuff has been removed, since I'm not yet fully aware of DMD 2.x's "invariant" stuff.
5) The next few days, I have only limited time available due to my real life job (hotels, travel and stuff).
6) I have trouble getting Vehicles to work properly. If I don't get it done within the next few days, I'll probably discard Newton and look for another physics solution, since I don't know where to look else. See my other thread.
ajung
 
Posts: 11
Joined: Sun Jan 18, 2009 8:22 am

Re: Newton 2.0 API and ABI compatibility

Postby predaeus » Wed Jan 21, 2009 1:21 pm

Ok, sorry for letting the cat out of the bag, I am just so excited about this.

1) yes, obviously this needs to be stable before it can be added officially
2) couldn't load the .so generated as recommended in viewtopic.php?f=9&t=4922 successfully yet
3) viewtopic.php?f=9&t=4934 will hopefully tell
4) is optimal for D 1.0 support
5) yea I need to calm down, sorry, no stress
6) can't tell but sounds like it will be resolved.
predaeus
 
Posts: 19
Joined: Wed Jan 21, 2009 10:49 am

Re: Newton 2.0 API and ABI compatibility and D

Postby Julio Jerez » Wed Jan 21, 2009 1:35 pm

if you are linking to c libraries you must use
gcc -x c++

if you are using dll, then it does not matters,
and about the licence, anything is compalible wioth newton, newton if free not strings attached.
Julio Jerez
Moderator
Moderator
 
Posts: 11155
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Newton 2.0 API and ABI compatibility and D

Postby ajung » Wed Jan 21, 2009 1:48 pm

The licence term that makes me worry is "4) The LICENSEE may not redistribute the SOFTWARE, except as part of a compiled software program that is not itself a physics library."

Now, as DerelictNewton is "source code", and therefore not a compiled software, I may not redistribute Newton along with it. So I may also not redistribute DerelictNewton because it is derived from Newton.h, which is part of Newton.

Other than 1.53, I didn't a reference to the licence in Newton 2.0 BETA. In this case, good ol' plain copyright does apply. This, on the other hand, would make a wrapper a simple copyright violation.

Guess, I'm too fearful.
ajung
 
Posts: 11
Joined: Sun Jan 18, 2009 8:22 am

Re: Newton 2.0 API and ABI compatibility and D

Postby JernejL » Wed Jan 21, 2009 2:03 pm

I don't see your problem, you just distribute the wrapper without the libraries, everyone can download newton to use it with the wrapper.. or is there another problem?
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1531
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: Newton 2.0 API and ABI compatibility and D

Postby Julio Jerez » Wed Jan 21, 2009 2:24 pm

ajung wrote:"4) The LICENSEE may not redistribute the SOFTWARE, except as part of a compiled software program that is not itself a physics library."

It means the you can use newton for everythong you want with the expception of a physics enigne library.

I did not write that junk, some one did for me, back in the day when phsyics engin where rare.
the bottom line is you can use netwon as you wish for anything. and you can distribute the libraries with your application, must people do.

In fact it is teh preffect way, since and application may use a vrsion of a library that may be diffrent that teh one in teh site.
Many user of newton have special versions of the library with spcial cofiguations they ask on request, specially people in universities.
Julio Jerez
Moderator
Moderator
 
Posts: 11155
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Newton 2.0 API and ABI compatibility and D

Postby ajung » Wed Jan 21, 2009 2:30 pm

The problem is, that DerelictNewton is derived from Newton.h. At least German law (the one I'm used to) requires the permission from the owner of the original work when creating derivative work. I doubt US law is much different.

That's the point where open source licenses come in: these licences, typically found at the beginning of an open source header, grant me the right, to do (whatever) under a list of given conditions...............
A simple copyright statement does not grant me this right, neither does Newtons license.txt.
ajung
 
Posts: 11
Joined: Sun Jan 18, 2009 8:22 am

Re: Newton 2.0 API and ABI compatibility and D

Postby ajung » Wed Jan 21, 2009 2:32 pm

Julio Jerez wrote:the bottom line is you can use netwon as you wish for anything. and you can distribute the libraries with your application, must people do.


OK, I give up. :)
ajung
 
Posts: 11
Joined: Sun Jan 18, 2009 8:22 am

Re: Newton 2.0 API and ABI compatibility and D

Postby Julio Jerez » Wed Jan 21, 2009 2:34 pm

do you mean to place teh licen on the header file? I can do that.

you will get it with the next beta tehi weekend.
there were few ineficency on the muthreaded code on AMD systems, I will post the SDK again, and put teh licence on the file header.

is that satisfactory?
Julio Jerez
Moderator
Moderator
 
Posts: 11155
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Newton 2.0 API and ABI compatibility

Postby ajung » Wed Jan 21, 2009 2:47 pm

predaeus wrote:2) couldn't load the .so generated as recommended in viewtopic.php?f=9&t=4922 successfully yet


Different compilers do different name mangling. It would'nt be the first time that the compiler adds "__underscores" to the symbols on different platforms.

Try exporting the symbol table from the shared file, I think "objdump -x <<your_lib>>" is the command to use, however I can't test it, as I have no working linux system at hand at the moment. Then see if the symbols match the one specified in "newton.d" (check for differences such as "__underscores").

Also check spelling of your shared_lib filename and see if it matches the one Derelict wants to load, this includes case-sensitivity. Also make sure, that the shared file is placed in the directory where linux stores ALL shared files. AFAIK you cannot have the shared lib in the application directory. (but probably you already know that^^)
ajung
 
Posts: 11
Joined: Sun Jan 18, 2009 8:22 am

Re: Newton 2.0 API and ABI compatibility and D

Postby ajung » Wed Jan 21, 2009 3:20 pm

Julio Jerez wrote:do you mean to place teh licen on the header file? I can do that.

you will get it with the next beta tehi weekend.
there were few ineficency on the muthreaded code on AMD systems, I will post the SDK again, and put teh licence on the file header.

is that satisfactory?


This topic is not easy.

It would be easiest, to place the *Header only* under OpenSource license, such as the zlib licence. However I understand that this is against the "closed source nature" of Newton.

Lets have a look how the PROs deal with this problem. For example, the panel SDK of MS Flight Simulator 2004 has a similar situation. MSFS itself is closed source. However, the SDK-headers and sample code are some kind of "open":

MSFS SDK wrote:[...]
1. GRANT OF LICENSE. This EULA grants you the following rights:

· Applications Software. You may install, access and run (“RUN”) the SOFTWARE PRODUCT on an unlimited number of computers, including workstations, terminals or other digital electronic devices ("COMPUTERS") to design, develop, and test software application products that are designed to operate in conjunction with Microsoft Flight Simulator 2004: A Century of Flight and subsequent versions thereof (“Application”).
· Sample Code. You may modify the sample source code located in the SOFTWARE PRODUCT’s “samples” directories (“Sample Code”) to design, develop, and test your Application. You may also reproduce and distribute the Sample Code in object code form along with any modifications you make to the Sample Code, provided that you comply with the Distribution Terms described below. For purposes of this section, “modifications” shall mean enhancements to the functionality of the Sample Code.
· Redistributable Code. You may reproduce and distribute portions of the SOFTWARE PRODUCT designated as “Redistributable Code” identified as the “BGLC.EXE,” “BGLPLACER.EXE,” “BGLCOMP.EXE,” and “TRAFFICINFO.DLL” files and other files which may be identified in the text file LICENSE\REDIST.TXT. You may redistribute the Redistributable Code with your Applications provided that you comply with the Distribution Terms described below.
· Reservation of Rights. All rights not expressly granted are reserved by Microsoft.
[...]


This is partially what I need: the grant to modify Newton.h, and the right to redistribute my modified version, but please not only in object code, but also as source code if possible (because DerelictNewton is distributed as source code, not as object code).
ajung
 
Posts: 11
Joined: Sun Jan 18, 2009 8:22 am

Re: Newton 2.0 API and ABI compatibility and D

Postby predaeus » Thu Jan 22, 2009 7:14 am

Julio I understand that you allow this usage/distribution of Newton with a binding wrapper that dynamically loads the Newton shared object when needed (Derelict). Unfortunately the license phrasing is missleading in this regard.

For example
4) The LICENSEE may not redistribute the SOFTWARE, except as part of a compiled software program that is not itself a physics library.

is not the same as
It means the you can use newton for everythong you want with the expception of a physics enigne library.


ajung is right, this should be sorted out, maybe with the help of someone experienced with licences/law. So people need not fear distributing Newton in binary form with their application (which is not a physics engine) or providing a port of the Newton header.
In reality it might be difficult to tell
a) what is just a language binding or dynamic loader that does not claim to be its own physics implementation and
b) what is a physics implementation that just uses Newton as a backend and therefore violates the current license

Hopefully we can find a solution to this, because I would really like to have Newton in something like Derelict for the D programming language as Derelict makes using those libraries easy.
predaeus
 
Posts: 19
Joined: Wed Jan 21, 2009 10:49 am

Next

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 2 guests