Re: Dynamically binding to D code using extern(D)

2021-09-30 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 30 September 2021 at 22:30:30 UTC, jfondren wrote: 3. dynamic linking (option 2), performed arbitrarily at runtime, by your program. If linking fails, you can do whatever you want about that. That's actually "dynamic loading". https://en.wikipedia.org/wiki/Dynamic_loading

Re: Dynamically binding to D code using extern(D)

2021-09-30 Thread Hipreme via Digitalmars-d-learn
to the external linkage too, handling GC-allocated data with extern(D) doesn't stop it from it being garbage collected, I'm fixing that kind of error right now again. separate applications and some form of interprocess communication (pipes, unix sockets, TCP sockets) instead of function calls

Re: Dynamically binding to D code using extern(D)

2021-09-30 Thread jfondren via Digitalmars-d-learn
On Thursday, 30 September 2021 at 18:09:46 UTC, Hipreme wrote: I write this post as both a learning tool, a question and an inquiry. There are just a lot of drawbacks in trying to do function exporting while using D. The terms that people use are a bit sloppy. There are three kinds of

Dynamically binding to D code using extern(D)

2021-09-30 Thread Hipreme via Digitalmars-d-learn
I write this post as both a learning tool, a question and an inquiry. There are just a lot of drawbacks in trying to do function exporting while using D. That interface is absurdly confuse and that is probably why I've never seen a project here which made an use of extern(D) while using

Re: What is the difference between extern(C++) extern(D)

2019-06-19 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, June 19, 2019 11:12:14 AM MDT lili via Digitalmars-d-learn wrote: > Hi Guys; > In the dmd source code, has lot of extern (C++), Why need this > and what is difference between extern(C++) extern(D), Thanks your > answer. extern(C++) is for making the name mang

What is the difference between extern(C++) extern(D)

2019-06-19 Thread lili via Digitalmars-d-learn
Hi Guys; In the dmd source code, has lot of extern (C++), Why need this and what is difference between extern(C++) extern(D), Thanks your answer.

Re: extern (D)?

2013-01-18 Thread Rob T
On Friday, 18 January 2013 at 07:34:35 UTC, Jacob Carlborg wrote: You cannot both have CTFE/inlining/templates and hide the source code. It's the same as in C++. Yes I am aware of that limitation, nothing can be done except lose the flexibility of templates and so forth, or keep it and

Re: extern (D)?

2013-01-18 Thread Simon
On 18/01/2013 08:09, Rob T wrote: On Friday, 18 January 2013 at 07:34:35 UTC, Jacob Carlborg wrote: You cannot both have CTFE/inlining/templates and hide the source code. It's the same as in C++. Yes I am aware of that limitation, nothing can be done except lose the flexibility of templates

Re: extern (D)?

2013-01-18 Thread Jacob Carlborg
On 2013-01-18 09:09, Rob T wrote: I have not yet seen examples or documentation explaining how to separate interface and implementation from a class or struct. Are you sure this can be done? Yes, it's supposed to work. Just create a class as you normally would and compile it as a library.

Re: extern (D)?

2013-01-18 Thread Johannes Pfau
Am Fri, 18 Jan 2013 01:07:05 + (UTC) schrieb Justin Whear jus...@economicmodeling.com: You can use extern(D) or simply extern; this is described here: http://dlang.org/attribute.html#linkage Justin BTW: I wonder how export should be used? It seems like it currently does nothing

Re: extern (D)?

2013-01-18 Thread Rob T
On Friday, 18 January 2013 at 04:46:46 UTC, Andrej Mitrovic wrote: On 1/18/13, Rob T al...@ucora.com wrote: however I read somewhere that it pretty much does nothing but strip out the comments because it needs the full source code for a inlining, CTFE, and templates. There was a recent pull

extern (D)?

2013-01-17 Thread Rob T
structures from D to C, and then from C back to D which is not a nice solution. As far as I know, there's no extern (D), but maybe there is something like it available. Anyone know? --rt

Re: extern (D)?

2013-01-17 Thread Justin Whear
using extern (C), but that means translating some structures from D to C, and then from C back to D which is not a nice solution. As far as I know, there's no extern (D), but maybe there is something like it available. Anyone know? --rt You can use extern(D) or simply extern

Re: extern (D)?

2013-01-17 Thread Andrej Mitrovic
On 1/18/13, Rob T al...@ucora.com wrote: The usual way to link in D libs into D code is to include the required D module source files, but that gives away all of the source code which in some instances is not possible to do (eg legal reasons). The other way.. The other way is to use D

Re: extern (D)?

2013-01-17 Thread Rob T
On Friday, 18 January 2013 at 01:07:05 UTC, Justin Whear wrote: You can use extern(D) or simply extern; this is described here: http://dlang.org/attribute.html#linkage Justin So there is an extern (D), excellent! Slightly embarrassed I didn't find this for myself. --rt

Re: extern (D)?

2013-01-17 Thread Rob T
On Friday, 18 January 2013 at 02:08:46 UTC, Andrej Mitrovic wrote: The other way is to use D interface files, which the compiler can automatically generate for you if you pass the -H switch. Also use the -op switch if you're generating multiple files at once, which will preserve directory

Re: extern (D)?

2013-01-17 Thread Andrej Mitrovic
On 1/18/13, Rob T al...@ucora.com wrote: however I read somewhere that it pretty much does nothing but strip out the comments because it needs the full source code for a inlining, CTFE, and templates. There was a recent pull that implemented better header generation

Re: extern (D)?

2013-01-17 Thread Jacob Carlborg
On 2013-01-18 05:37, Rob T wrote: The documentation says that the interface files will only contain the parts of a module's source code that is required for linking, however I read somewhere that it pretty much does nothing but strip out the comments because it needs the full source code for a