www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Is there such a thing?

reply "Taylor Hillegeist" <taylorh140 gmail.com> writes:
So, In languages like .net they have dll's that contain not only 
bytecode but also the necessary headers to make them usable in 
any .net language. I was curious if this kind of thing has ever 
been attempted for static libraries?

basically some type of universal header + static library = 
Everything Needed to use in project file.

of course they would be targeted for a certain platform but would 
be really easy to grab/use.

And if the header could be agreed upon any compiled language 
could use the library which would be a huge benefit.

Perhaps i'm incorrect in my assumptions. Let me know what you 
think about the idea?
Feb 26 2015
next sibling parent reply "Marc =?UTF-8?B?U2Now7x0eiI=?= <schuetzm gmx.net> writes:
On Thursday, 26 February 2015 at 19:53:54 UTC, Taylor Hillegeist 
wrote:
 So, In languages like .net they have dll's that contain not 
 only bytecode but also the necessary headers to make them 
 usable in any .net language. I was curious if this kind of 
 thing has ever been attempted for static libraries?

 basically some type of universal header + static library = 
 Everything Needed to use in project file.

 of course they would be targeted for a certain platform but 
 would be really easy to grab/use.

 And if the header could be agreed upon any compiled language 
 could use the library which would be a huge benefit.

 Perhaps i'm incorrect in my assumptions. Let me know what you 
 think about the idea?
IIRC, Pascal unit files work that way. No interface source file is required to use them.
Feb 26 2015
parent reply "Taylor Hillegeist" <taylorh140 gmail.com> writes:
On Thursday, 26 February 2015 at 21:37:46 UTC, Marc Schütz wrote:
 On Thursday, 26 February 2015 at 19:53:54 UTC, Taylor 
 Hillegeist wrote:
 So, In languages like .net they have dll's that contain not 
 only bytecode but also the necessary headers to make them 
 usable in any .net language. I was curious if this kind of 
 thing has ever been attempted for static libraries?

 basically some type of universal header + static library = 
 Everything Needed to use in project file.

 of course they would be targeted for a certain platform but 
 would be really easy to grab/use.

 And if the header could be agreed upon any compiled language 
 could use the library which would be a huge benefit.

 Perhaps i'm incorrect in my assumptions. Let me know what you 
 think about the idea?
IIRC, Pascal unit files work that way. No interface source file is required to use them.
That Looks pretty close to exactly correct: http://www.freepascal.org/docs-html/user/userse11.html It was still two files but it looks like the .ppu was analogous to a c header. like the compiler striped out all the necessary declarations. Very interesting... But I don't think it makes it easier to link to with d. The idea is pretty cool though. I wonder if other compilers do the work of creating sources with the logic striped out for use as a header only. One of the listed uses for a unit was if the developer wanted to hide his ip but allow others to use the code. Does D have a way of doing this?
Feb 26 2015
parent ketmar <ketmar ketmar.no-ip.org> writes:
On Thu, 26 Feb 2015 22:10:15 +0000, Taylor Hillegeist wrote:

 One of the listed uses for a unit was if the developer wanted to hide
 his ip but allow others to use the code.

 Does D have a way of doing this?
you can compile static library and provide autogenerated .di file.=20 compiler will strip out all unnecessary parts from it.=
Feb 26 2015
prev sibling parent reply Jacob Carlborg <doob me.com> writes:
On 2015-02-26 20:53, Taylor Hillegeist wrote:
 So, In languages like .net they have dll's that contain not only
 bytecode but also the necessary headers to make them usable in any .net
 language. I was curious if this kind of thing has ever been attempted
 for static libraries?

 basically some type of universal header + static library = Everything
 Needed to use in project file.

 of course they would be targeted for a certain platform but would be
 really easy to grab/use.

 And if the header could be agreed upon any compiled language could use
 the library which would be a huge benefit.

 Perhaps i'm incorrect in my assumptions. Let me know what you think
 about the idea?
I think it's better to use a package manager to handle this. It will also automatically download the necessary files. Also it will help (hopefully) you to find the libraries you need. -- /Jacob Carlborg
Feb 26 2015
parent reply "Taylor Hillegeist" <taylorh140 gmail.com> writes:
On Friday, 27 February 2015 at 07:26:06 UTC, Jacob Carlborg wrote:
 On 2015-02-26 20:53, Taylor Hillegeist wrote:
 So, In languages like .net they have dll's that contain not 
 only
 bytecode but also the necessary headers to make them usable in 
 any .net
 language. I was curious if this kind of thing has ever been 
 attempted
 for static libraries?

 basically some type of universal header + static library = 
 Everything
 Needed to use in project file.

 of course they would be targeted for a certain platform but 
 would be
 really easy to grab/use.

 And if the header could be agreed upon any compiled language 
 could use
 the library which would be a huge benefit.

 Perhaps i'm incorrect in my assumptions. Let me know what you 
 think
 about the idea?
I think it's better to use a package manager to handle this. It will also automatically download the necessary files. Also it will help (hopefully) you to find the libraries you need.
I just think its a shame that all over the place people are compiling code in different programming languages, and although all the .o files are compatible with each other there isn't a standard cross language way of defining a binding. But that would be making people agree on things...
Feb 27 2015
next sibling parent reply Jacob Carlborg <doob me.com> writes:
On 2015-02-27 20:49, Taylor Hillegeist wrote:

 I just think its a shame that all over the place people are compiling
 code in different programming languages, and although all the .o  files
 are compatible with each other there isn't a standard cross language way
 of defining a binding. But that would be making people agree on things...
I think that's a completely different topic. -- /Jacob Carlborg
Feb 27 2015
parent reply "H. S. Teoh via Digitalmars-d" <digitalmars-d puremagic.com> writes:
On Fri, Feb 27, 2015 at 09:00:56PM +0100, Jacob Carlborg via Digitalmars-d
wrote:
 On 2015-02-27 20:49, Taylor Hillegeist wrote:
 
I just think its a shame that all over the place people are compiling
code in different programming languages, and although all the .o
files are compatible with each other there isn't a standard cross
language way of defining a binding. But that would be making people
agree on things...
I think that's a completely different topic.
[...] http://xkcd.com/927/ :-P T -- It is widely believed that reinventing the wheel is a waste of time; but I disagree: without wheel reinventers, we would be still be stuck with wooden horse-cart wheels.
Feb 27 2015
parent reply "Taylor Hillegeist" <taylorh140 gmail.com> writes:
On Friday, 27 February 2015 at 21:15:10 UTC, H. S. Teoh wrote:
 On Fri, Feb 27, 2015 at 09:00:56PM +0100, Jacob Carlborg via 
 Digitalmars-d wrote:
 On 2015-02-27 20:49, Taylor Hillegeist wrote:
 
I just think its a shame that all over the place people are 
compiling
code in different programming languages, and although all the 
.o
files are compatible with each other there isn't a standard 
cross
language way of defining a binding. But that would be making 
people
agree on things...
I think that's a completely different topic.
[...] http://xkcd.com/927/ :-P T
Yes, But in this case there is like 300 non-competing non-standards.
Feb 27 2015
parent "H. S. Teoh via Digitalmars-d" <digitalmars-d puremagic.com> writes:
On Sat, Feb 28, 2015 at 12:35:56AM +0000, Taylor Hillegeist via Digitalmars-d
wrote:
 On Friday, 27 February 2015 at 21:15:10 UTC, H. S. Teoh wrote:
On Fri, Feb 27, 2015 at 09:00:56PM +0100, Jacob Carlborg via Digitalmars-d
wrote:
On 2015-02-27 20:49, Taylor Hillegeist wrote:

I just think its a shame that all over the place people are
compiling code in different programming languages, and although all
the .o files are compatible with each other there isn't a standard
cross language way of defining a binding. But that would be making
people agree on things...
I think that's a completely different topic.
[...] http://xkcd.com/927/ :-P T
Yes, But in this case there is like 300 non-competing non-standards.
And soon there will be 301 non-competing non-standards. ;-) T -- Question authority. Don't ask why, just do it.
Feb 27 2015
prev sibling next sibling parent reply "Dicebot" <public dicebot.lv> writes:
On Friday, 27 February 2015 at 19:49:37 UTC, Taylor Hillegeist 
wrote:
 I just think its a shame that all over the place people are 
 compiling code in different programming languages, and although 
 all the .o  files are compatible with each other there isn't a 
 standard cross language way of defining a binding. But that 
 would be making people agree on things...
C is pretty much a standard for cross-language ABI
Feb 28 2015
next sibling parent Jacob Carlborg <doob me.com> writes:
On 2015-02-28 18:06, Dicebot wrote:

 C is pretty much a standard for cross-language ABI
You still need a way to define the bindings. -- /Jacob Carlborg
Mar 01 2015
prev sibling parent reply "Kagamin" <spam here.lot> writes:
On Saturday, 28 February 2015 at 17:06:58 UTC, Dicebot wrote:
 On Friday, 27 February 2015 at 19:49:37 UTC, Taylor Hillegeist 
 wrote:
 I just think its a shame that all over the place people are 
 compiling code in different programming languages, and 
 although all the .o  files are compatible with each other 
 there isn't a standard cross language way of defining a 
 binding. But that would be making people agree on things...
C is pretty much a standard for cross-language ABI
Object files have no language-level compatibility, only linker-level compatibility. You can get function arguments wrong, and linker won't tell you.
Mar 03 2015
parent reply "Taylor Hillegeist" <taylorh140 gmail.com> writes:
On Tuesday, 3 March 2015 at 10:37:49 UTC, Kagamin wrote:
 On Saturday, 28 February 2015 at 17:06:58 UTC, Dicebot wrote:
 On Friday, 27 February 2015 at 19:49:37 UTC, Taylor Hillegeist 
 wrote:
 I just think its a shame that all over the place people are 
 compiling code in different programming languages, and 
 although all the .o  files are compatible with each other 
 there isn't a standard cross language way of defining a 
 binding. But that would be making people agree on things...
C is pretty much a standard for cross-language ABI
Object files have no language-level compatibility, only linker-level compatibility. You can get function arguments wrong, and linker won't tell you.
So, I don't thing C is very easy to pull data from, In fact i would guess the only way this would work is if the compiler produced standard data format like JSON or XML or YAML if you like that kind of thing. And then transformed it to native code. <CStyleFunction="Foo"> <ReturnType> <sint32> </ReturnType> <Parameter> <Float64="MyFloat"> </Parameter> </CStyleFunction> I think YAML would look nicer... I also know that some languages have certain capabilities. And this is a lot more complex of problem. But I hear about people making automatic binding generators and all sorts of 1 off tools, I just don't understand why there doesn't seem to be common standard solution.
Mar 03 2015
parent "Kagamin" <spam here.lot> writes:
On Tuesday, 3 March 2015 at 17:17:18 UTC, Taylor Hillegeist wrote:
 <CStyleFunction="Foo">
   <ReturnType>
     <sint32>
   </ReturnType>
   <Parameter>
     <Float64="MyFloat">
   </Parameter>
 </CStyleFunction>
That's WSDL. It works fine for simple data types. The problem is what to do with complex data types.
Mar 04 2015
prev sibling parent reply "Paulo Pinto" <pjmlp progtools.org> writes:
On Friday, 27 February 2015 at 19:49:37 UTC, Taylor Hillegeist 
wrote:
 On Friday, 27 February 2015 at 07:26:06 UTC, Jacob Carlborg 
 wrote:
 On 2015-02-26 20:53, Taylor Hillegeist wrote:
 So, In languages like .net they have dll's that contain not 
 only
 bytecode but also the necessary headers to make them usable 
 in any .net
 language. I was curious if this kind of thing has ever been 
 attempted
 for static libraries?

 basically some type of universal header + static library = 
 Everything
 Needed to use in project file.

 of course they would be targeted for a certain platform but 
 would be
 really easy to grab/use.

 And if the header could be agreed upon any compiled language 
 could use
 the library which would be a huge benefit.

 Perhaps i'm incorrect in my assumptions. Let me know what you 
 think
 about the idea?
I think it's better to use a package manager to handle this. It will also automatically download the necessary files. Also it will help (hopefully) you to find the libraries you need.
I just think its a shame that all over the place people are compiling code in different programming languages, and although all the .o files are compatible with each other there isn't a standard cross language way of defining a binding. But that would be making people agree on things...
On Windows that standard it is called COM for OO languages, stdcall/pascal for procedural ones and BCL for those targeting .NET. -- Paulo
Feb 28 2015
parent "Paulo Pinto" <pjmlp progtools.org> writes:
On Saturday, 28 February 2015 at 17:24:57 UTC, Paulo Pinto wrote:
 On Friday, 27 February 2015 at 19:49:37 UTC, Taylor Hillegeist 
 wrote:
 On Friday, 27 February 2015 at 07:26:06 UTC, Jacob Carlborg 
 wrote:
 On 2015-02-26 20:53, Taylor Hillegeist wrote:
 So, In languages like .net they have dll's that contain not 
 only
 bytecode but also the necessary headers to make them usable 
 in any .net
 language. I was curious if this kind of thing has ever been 
 attempted
 for static libraries?

 basically some type of universal header + static library = 
 Everything
 Needed to use in project file.

 of course they would be targeted for a certain platform but 
 would be
 really easy to grab/use.

 And if the header could be agreed upon any compiled language 
 could use
 the library which would be a huge benefit.

 Perhaps i'm incorrect in my assumptions. Let me know what 
 you think
 about the idea?
I think it's better to use a package manager to handle this. It will also automatically download the necessary files. Also it will help (hopefully) you to find the libraries you need.
I just think its a shame that all over the place people are compiling code in different programming languages, and although all the .o files are compatible with each other there isn't a standard cross language way of defining a binding. But that would be making people agree on things...
On Windows that standard it is called COM for OO languages, stdcall/pascal for procedural ones and BCL for those targeting .NET. -- Paulo
Sorry, should have written CLS (Common Language Specification) for those targeting .NET.
Feb 28 2015