www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - interop with other environments

reply mike <mike nospam.com> writes:
Hello,

I really like D syntax and would like to create one library in D language. Now,
is it possible to use this library in .NET, Python, Ruby or PHP? How it could
be done? You don't have to explain all, just point me please in the right
direction. I was trying to find some more information but the fact that the
language is called "D", it's pretty hard to google these things.
Apr 25 2007
next sibling parent =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
mike wrote:

 the fact that the language is called "D", it's pretty hard to google these
things.
No, it doesn't. You google for "D language" or "D programming language". Or: http://directory.google.com/Top/Computers/Programming/Languages/D/ --anders
Apr 26 2007
prev sibling next sibling parent reply Alexander Panek <alexander.panek brainsware.org> writes:
On Thu, 26 Apr 2007 02:49:34 -0400
mike <mike nospam.com> wrote:

 Hello,
 
 I really like D syntax and would like to create one library in D
 language. Now, is it possible to use this library in .NET, Python,
 Ruby or PHP? How it could be done? You don't have to explain all,
 just point me please in the right direction. I was trying to find
 some more information but the fact that the language is called "D",
 it's pretty hard to google these things.
As long as there is a C bridge possible, you can use almost any library you wish. I don't know whether that's possible with .NET, but the other ones shouldn't be a problem. You might be interested in PyD[1], and bcd.gen[2]. Kind regards, Alex [1] http://dsource.org/projects/pyd [2] http://dsource.org/projects/bcd
Apr 26 2007
parent reply Max Samukha <samukha voliacable.com> writes:
On Thu, 26 Apr 2007 09:56:54 +0200, Alexander Panek
<alexander.panek brainsware.org> wrote:

On Thu, 26 Apr 2007 02:49:34 -0400
mike <mike nospam.com> wrote:

 Hello,
 
 I really like D syntax and would like to create one library in D
 language. Now, is it possible to use this library in .NET, Python,
 Ruby or PHP? How it could be done? You don't have to explain all,
 just point me please in the right direction. I was trying to find
 some more information but the fact that the language is called "D",
 it's pretty hard to google these things.
As long as there is a C bridge possible, you can use almost any library you wish. I don't know whether that's possible with .NET, but the other ones shouldn't be a problem. You might be interested in PyD[1], and bcd.gen[2]. Kind regards, Alex [1] http://dsource.org/projects/pyd [2] http://dsource.org/projects/bcd
Using what they call P/Invoke, you should be able to access from a .NET assembly any C functions exported by a dll compiled from D source. If you are adventurous enough you could even try to create a COM wrapper around a .NET assembly and use it from D.
Apr 26 2007
next sibling parent reply Alexander Panek <alexander.panek brainsware.org> writes:
On Thu, 26 Apr 2007 13:06:03 +0300
Max Samukha <samukha voliacable.com> wrote:
 Using what they call P/Invoke, you should be able to access from a
 .NET assembly any C functions exported by a dll compiled from D
 source. If you are adventurous enough you could even try to create a
 COM wrapper around a .NET assembly and use it from D.
:O That sounds disgusting and evul! *hides*
Apr 26 2007
next sibling parent Dan <murpsoft hotmail.com> writes:
Alexander Panek Wrote:

 On Thu, 26 Apr 2007 13:06:03 +0300
 Max Samukha <samukha voliacable.com> wrote:
 Using what they call P/Invoke, you should be able to access from a
 .NET assembly any C functions exported by a dll compiled from D
 source. If you are adventurous enough you could even try to create a
 COM wrapper around a .NET assembly and use it from D.
:O That sounds disgusting and evul! *hides*
I don't think Microsoft is evil, I just think their programmers are overpaid, and their marketers underpaid. Yeah, using a Microsoft interface spec to access stuff from a Microsoft runtime environment written in a Microsoft programming language sounds disgusting all right. But... some people like it dirty.
Apr 26 2007
prev sibling parent jcc7 <technocrat7 gmail.com> writes:
== Quote from Alexander Panek (alexander.panek brainsware.org)'s article
 On Thu, 26 Apr 2007 13:06:03 +0300
 Max Samukha <samukha voliacable.com> wrote:
 Using what they call P/Invoke, you should be able to access from a
 .NET assembly any C functions exported by a dll compiled from D
 source. If you are adventurous enough you could even try to create
 a COM wrapper around a .NET assembly and use it from D.
:O That sounds disgusting and evul! *hides*
Well, I won't argue that ethics of such a choice ( ;) ), but it should be possible. I created a COM library with VB.NET. I just used Juno (oldrev's version) to create an object from the COM library in a D program. I don't know how practical it is, but it come in handy. jcc7
Apr 26 2007
prev sibling parent reply mike <mike nospam.com> writes:
Thank you all for feedback, I'm really surprised how active and useful this
mailing-list is.

Max,

you said, I could have "C functions exported by a dll compiled from D source"
and I think this is actually what I'm looking for. Do you know how it could be
done?

Thanks

 Using what they call P/Invoke, you should be able to access from a
 .NET assembly any C functions exported by a dll compiled from D
 source. If you are adventurous enough you could even try to create a
 COM wrapper around a .NET assembly and use it from D.
Apr 26 2007
parent Bill Baxter <dnewsgroup billbaxter.com> writes:
mike wrote:
 Thank you all for feedback, I'm really surprised how active and useful this
mailing-list is.
 
 Max,
 
 you said, I could have "C functions exported by a dll compiled from D source"
and I think this is actually what I'm looking for. Do you know how it could be
done?
 
 Thanks
 
 Using what they call P/Invoke, you should be able to access from a
 .NET assembly any C functions exported by a dll compiled from D
 source. If you are adventurous enough you could even try to create a
 COM wrapper around a .NET assembly and use it from D.
For DMD on Windows, this is what you want: http://www.digitalmars.com/d/dll.html --bb
Apr 26 2007
prev sibling next sibling parent jcc7 <technocrat7 gmail.com> writes:
== Quote from mike (mike nospam.com)'s article
...
 I was trying to find some more information but the fact that the
 language is called "D", it's pretty hard to google these things.
It's not really as hard as you make it seem (and it keeps on getting easier). Maybe you could benefit from a few tips: http://www.prowiki.org/wiki4d/wiki.cgi?SearchingTips
Apr 26 2007
prev sibling parent mike <mike nospam.com> writes:
Yes, exactly. Thanks a lot, I'm diving into it right now.
Apr 26 2007