digitalmars.D - writing library in D for Linux and other OSes
- mrkafk (14/14) Feb 14 2013 Hello,
- Martin Nowak (8/14) Feb 14 2013 Hard to say, it depends on the implementation of your language's
- mrkafk (5/18) Feb 19 2013 Could you elaborate on this point (precise allocator) pls? Do you
- lomereiter (4/7) May 19 2013 Can you please elaborate on this?
Hello, D (complete) newbie here. Being sick of C/C++ I would like to write my next library in D lang. It seems that wrting Win DLL is easy or perhaps workable at least (http://dlang.org/dll.html ), but what about other OSes, Linux at least? And iOS + OS X? Specifically, I need to write library usable from Python. There's PYD, I know, but in general, if I wanted to call that library from other languages using C interface, how well it works in practice? Another issue is GC: can I use D's garbage collection (realtime-like performance is not necessary for my needs) in the library and it will "just work" in say Python code? Or not? Thanks!
Feb 14 2013
Specifically, I need to write library usable from Python. There's PYD, I know, but in general, if I wanted to call that library from other languages using C interface, how well it works in practice?see "Status of Dynamically Loadable D Libraries" post from http://forum.dlang.org/thread/sixndlzafvkehvrcevhx forum.dlang.orgAnother issue is GC: can I use D's garbage collection (realtime-like performance is not necessary for my needs) in the library and it will "just work" in say Python code? Or not?Hard to say, it depends on the implementation of your language's interpreter and might break at some point (precise collector). It also depends on how you represent the D objects/memory but it's a problem that someone creating a binding should address. You might want to look at LuaD and PyD http://wiki.dlang.org/Libraries_and_Frameworks#Scripting_D_applications.
Feb 14 2013
Could you elaborate on this point (precise allocator) pls? Do you mean that library written in D will have its own D-provided GC and this will get in the way of either memory allocator or GC of a program using the library?Another issue is GC: can I use D's garbage collection (realtime-like performance is not necessary for my needs) in the library and it will "just work" in say Python code? Or not?Hard to say, it depends on the implementation of your language's interpreter and might break at some point (precise collector).It also depends on how you represent the D objects/memory but it's a problem that someone creating a binding should address. You might want to look at LuaD and PyD http://wiki.dlang.org/Libraries_and_Frameworks#Scripting_D_applications.Thanks!! I'm looking at this.
Feb 19 2013
Hard to say, it depends on the implementation of your language's interpreter and might break at some point (precise collector).Can you please elaborate on this? Recently I tried to make bindings for a D library to use it via FFI. They work just fine with Python 2.7 and PyPy 2.0, but segfault with Python 3.2. What could be the reason?
May 19 2013