New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implemented Lua C API and LuaJIT Wrappers for CoolProp #440
Conversation
…I currently implemented).
|
I install LuaJIT on my Debian system and test it here. Hang on. |
|
Check also that PUC-Lua wrapper works too on your Debian system. |
|
I guess you have to help a little bit, here is the first error: |
|
I tried adding the |
|
The capi.c needs only be build when using PUC Lua, you can go ahead and just run |
|
Sorry, but #436 has to be solved first. I would like to update my installed library... |
I'd appreciate it if you updated |
|
You may also find this useful for the |
|
Thanks @craigbarnes, I added the license information (thanks for that great config), and also added detection of luaL_newlib. |
|
Compilation and |
|
... or the C version if the example uses the FFI. |
|
It will (the example and the |
|
I will add more documentation to |
|
OK. Just let me know if you need someone to do more testing. |
|
I will shape this a little bit more (maybe add it to LuaRocks as well). I will let you know when I feel that this is ready to be merged. At its current shape it doesn't look too bad when compared to others in the wrappers folder. So I think we are quite close to integrate it (I had some problems with |
|
How about windows? I guess the makefile might not work, but otherwise On Thu, Jan 29, 2015 at 1:38 PM, Aapo Talvensaari notifications@github.com
|
…tion. Added more examples. Added some error handling.
…xed Lua C-API bindings to have same funcs that FFI version has.
|
Now that the bug #441 is fixed I think that I have finished implementing this. I have also added documentation (see: https://github.com/bungle/CoolProp/tree/master/wrappers/Lua). So I consider this as good-to-be-merged with upstream. I'm not sure if this needs to be integrated with Cmake build process, but I think that you can figure it out? Regards |
|
Yes, very nice work! Out of curiosity, what are you planning on using On Fri, Jan 30, 2015 at 5:54 AM, Aapo Talvensaari notifications@github.com
|
|
@ibell, well it all started from this message to lua-l (a mailing list): So, I'm not the end user. Although sometimes I wish that I could do some scientific work as well, but I'm a programmer, not a scientist. CoolLib is a really nice library. I learned this and that about thermodynamics when implemented it, and now I know where to look if I ever get to the point where I would need to solve problem related to thermodynamics. I found your high-level C API and thought that it would be simple to do. So I started with LuaJIT and implemented FFI interface to it in couple of hours. I informed Renaud of that but he said that he's using Lua 5.1. I had never done any Lua C API bindings so I thought this could be a good excercise because the high-level API of CoolProp is dead-simple. I also want to learn more about C and its toolset (make, cmake, gcc etc.). Why I did it? Because I could, and I wanted to learn. That's all. Great library indeed. I think Lua is somewhat a hidden gem. More and more people seem to find it though. Google and Facebook are using https://github.com/torch/torch7 and there is also http://www.scilua.org/. Also the Lua was originally developed for the people working on scientific and mathematical topics, more about it here: http://www.lua.org/history.html. So I think that Lua is a perfect match for people working with Thermodynamics. My personal interest in Lua focuses to OpenResty (http://openresty.org/ - Nginx based web development platform / framework). |
|
Great, let's hope that someone comes along to test the C implementation. |
Implemented Lua C API and LuaJIT Wrappers for CoolProp
| COOLPROP_LDLIBS ?= $(or $(shell $(PKGCONFIG) --libs-only-l CoolProp), -lCoolProp) | ||
| COOLPROP_INCDIR ?= $(shell $(PKGCONFIG) --variable=includedir CoolProp) | ||
| COOLPROP_LIBDIR ?= $(shell $(PKGCONFIG) --variable=libdir CoolProp) | ||
| COOLPROP_HEADER ?= $(or $(COOLPROP_INCDIR) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line doesn't seem right...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request? Snark helps no one.
On Feb 1, 2015 10:02 PM, "Craig Barnes" notifications@github.com wrote:
In wrappers/Lua/Makefile
#440 (comment):@@ -0,0 +1,36 @@
+include lualib.mk
+
+COOLPROP_CFLAGS ?=$(shell $ (PKGCONFIG) --cflags CoolProp)
+COOLPROP_LDFLAGS ?=$(shell $ (PKGCONFIG) --libs-only-L CoolProp)
+COOLPROP_LDLIBS ?=$(or $ (shell $(PKGCONFIG) --libs-only-l CoolProp), -lCoolProp)
+COOLPROP_INCDIR ?=$(shell $ (PKGCONFIG) --variable=includedir CoolProp)
+COOLPROP_LIBDIR ?=$(shell $ (PKGCONFIG) --variable=libdir CoolProp)
+COOLPROP_HEADER ?=$(or $ (COOLPROP_INCDIR)This line seems wrong in at least 3 ways.
—
Reply to this email directly or view it on GitHub
https://github.com/CoolProp/CoolProp/pull/440/files#r23905306.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, point taken. I edited my comment shortly after posting it. The line in question isn't actually used, so the fix would just be to remove it.
|
I added a pull request to remove unneeded lines from makefile: |
Okay, here is the first version where I implemented both Lua C API, and LuaJIT FFI wrappers. The
Makefileis rudimentary, and theREADME.rstis currently just a placeholder. I have tested these on my Mac OSX 10.9.5, but I have not yet checked other platforms. Please give a feedback, and suggestions on these to get merged with the upstream. I had never earlier done any Lua C API bindings (only LuaJIT FFIs), so it would be good if someone more experienced with Lua C API could look at these.