digitalmars.D.learn - Dynamic Libaries in D
- Tim M (9/9) Oct 12 2008 Can someone help me with dynamic libraries in d. I've seen this
- Lars Ivar Igesund (9/19) Oct 12 2008 Unless you really need DLL's, and not only dynamic libraries - look into
- BLS (10/28) Oct 12 2008 I can't agree with Lars "Snowman" Igesund. DDL is not ready for
- Lars Ivar Igesund (9/30) Oct 12 2008 He was clearly talking about Windows dll's, and they will _never_ be
- BLS (13/40) Oct 12 2008 Hi Lars,
- Lars Ivar Igesund (9/11) Oct 12 2008 There are several reasons, most of which should be explained on the DDL
- Tim M (3/3) Oct 12 2008 DDL looks nice but can I make DDLs in DLL format that can be loaded and ...
- Michael Robellard (11/14) Oct 13 2008 If your reason for writing a DLL is to interface into a 3rd party
- Tim M (4/26) Oct 13 2008 So do I just have to use C/C++ and is there any plans / current projects...
- Christopher Wright (17/19) Oct 13 2008 No, you just have to do this:
- Tim M (5/24) Oct 13 2008 Sorry if I haven't made myself clear enough. The main issue i'm worried ...
- Mike Parker (5/8) Oct 14 2008 Not quite. That would be extern(C). Using the Windows version will give
- Christopher Wright (3/13) Oct 14 2008 Groovy, thanks. I use Linux, and even there I don't use extern; thus my
Can someone help me with dynamic libraries in d. I've seen this http://www.digitalmars.com/d/2.0/dll.html as an example of windows dll and a similar example of using tango here http://dsource.org/projects/tango/wiki/TutDLL but both say multiple threads not supported. How can I make a dll in d that supports multi threads. I would also like to make linux modules so how can I do the initialization and finalization for those or can the compiler do it for me without coding it?
Oct 12 2008
Tim M wrote:Can someone help me with dynamic libraries in d. I've seen this http://www.digitalmars.com/d/2.0/dll.html as an example of windows dll and a similar example of using tango here http://dsource.org/projects/tango/wiki/TutDLL but both say multiple threads not supported. How can I make a dll in d that supports multi threads. I would also like to make linux modules so how can I do the initialization and finalization for those or can the compiler do it for me without coding it?Unless you really need DLL's, and not only dynamic libraries - look into DDL. http://www.dsource.org/projects/ddl -- Lars Ivar Igesund blog at http://larsivi.net DSource, #d.tango & #D: larsivi Dancing the Tango
Oct 12 2008
Lars Ivar Igesund schrieb:Tim M wrote:I can't agree with Lars "Snowman" Igesund. DDL is not ready for production use. (Especially related to ix based systems) Windows DMD created DLL's are almost un-useable. No classes, no threads, no exeption handling. I am using DMD DLLs nevertheless (simply by creating wrappers functions around classes), but in general I would like to say: Using DMD shared libs is like bying tools from Shitty Butthead very LTD and I am afraid the situation will not change for quit a while. BjoernCan someone help me with dynamic libraries in d. I've seen this http://www.digitalmars.com/d/2.0/dll.html as an example of windows dll and a similar example of using tango here http://dsource.org/projects/tango/wiki/TutDLL but both say multiple threads not supported. How can I make a dll in d that supports multi threads. I would also like to make linux modules so how can I do the initialization and finalization for those or can the compiler do it for me without coding it?Unless you really need DLL's, and not only dynamic libraries - look into DDL. http://www.dsource.org/projects/ddl
Oct 12 2008
BLS wrote:Lars Ivar Igesund schrieb:He was clearly talking about Windows dll's, and they will _never_ be production ready in D, whereas DDL is. In this particular case, it seems that *nix performance is irrelevant. -- Lars Ivar Igesund blog at http://larsivi.net DSource, #d.tango & #D: larsivi Dancing the TangoTim M wrote:I can't agree with Lars "Snowman" Igesund. DDL is not ready for production use. (Especially related to ix based systems)Can someone help me with dynamic libraries in d. I've seen this http://www.digitalmars.com/d/2.0/dll.html as an example of windows dll and a similar example of using tango here http://dsource.org/projects/tango/wiki/TutDLL but both say multiple threads not supported. How can I make a dll in d that supports multi threads. I would also like to make linux modules so how can I do the initialization and finalization for those or can the compiler do it for me without coding it?Unless you really need DLL's, and not only dynamic libraries - look into DDL. http://www.dsource.org/projects/ddl
Oct 12 2008
Lars Ivar Igesund schrieb:BLS wrote:Hi Lars, Quote Tim M. I would also like to make linux modules so how can I do the initialization and finalization for those ... End Quote. However, I use D DLLs by using the extern windows interface and the current behaviour is almost okay for me. But in case that I need extern D {} in order to create plugins for my D application .... you know. Borland's C++ compiler has support for that kind of shared libraries, so it is reasonable to ask : Why D has not. Kind regards, bjoen PS: will _never_ be production ready.. Why ?Lars Ivar Igesund schrieb:He was clearly talking about Windows dll's, and they will _never_ be production ready in D, whereas DDL is. In this particular case, it seems that *nix performance is irrelevant.Tim M wrote:I can't agree with Lars "Snowman" Igesund. DDL is not ready for production use. (Especially related to ix based systems)Can someone help me with dynamic libraries in d. I've seen this http://www.digitalmars.com/d/2.0/dll.html as an example of windows dll and a similar example of using tango here http://dsource.org/projects/tango/wiki/TutDLL but both say multiple threads not supported. How can I make a dll in d that supports multi threads. I would also like to make linux modules so how can I do the initialization and finalization for those or can the compiler do it for me without coding it?Unless you really need DLL's, and not only dynamic libraries - look into DDL. http://www.dsource.org/projects/ddl
Oct 12 2008
BLS wrote:Kind regards, bjoen PS: will _never_ be production ready.. Why ?There are several reasons, most of which should be explained on the DDL pages. It has to do with exception handling, sharing of symbols, etc. -- Lars Ivar Igesund blog at http://larsivi.net DSource, #d.tango & #D: larsivi Dancing the Tango
Oct 12 2008
DDL looks nice but can I make DDLs in DLL format that can be loaded and linked to an existing host application. I don't have access to the source code for the host app.
Oct 12 2008
If your reason for writing a DLL is to interface into a 3rd party applpication. Which is the reason we are using DLLs in D then chances are the extern(Windows) or extern(C) style functions are what you want anyway. You can use D features behind your C style interfaces. We have successfully done this with implementing In process COM servers in D. If you want to just have nice dynamically loaded modules in your own native D app then from what I've seen DDL will be the right way to go when it's ready. If you want your application to be able to be extended by others, then you are back to DLLs since most people extending your application will probably not be using D. "Tim M" <a b.com> wrote in message news:op.uixsjpl3jdp9fl tim-laptop.ssiltd.home...DDL looks nice but can I make DDLs in DLL format that can be loaded and linked to an existing host application. I don't have access to the source code for the host app.
Oct 13 2008
So do I just have to use C/C++ and is there any plans / current projects that this may change in future? On Tue, 14 Oct 2008 01:26:43 +1300, Michael Robellard <mrobellard ag.com> wrote:If your reason for writing a DLL is to interface into a 3rd party applpication. Which is the reason we are using DLLs in D then chances are the extern(Windows) or extern(C) style functions are what you want anyway. You can use D features behind your C style interfaces. We have successfully done this with implementing In process COM servers in D. If you want to just have nice dynamically loaded modules in your own native D app then from what I've seen DDL will be the right way to go when it's ready. If you want your application to be able to be extended by others, then you are back to DLLs since most people extending your application will probably not be using D. "Tim M" <a b.com> wrote in message news:op.uixsjpl3jdp9fl tim-laptop.ssiltd.home...DDL looks nice but can I make DDLs in DLL format that can be loaded and linked to an existing host application. I don't have access to the source code for the host app.
Oct 13 2008
Tim M wrote:So do I just have to use C/C++ and is there any plans / current projects that this may change in future?No, you just have to do this: extern (Windows) { // The application calls this void someDllFunc () { // regular D code here } } void someNonDllFunc () { // The application doesn't see this. } extern (Windows) tells the compiler to disguise the functions so they look like regular C functions in the resulting object file. It doesn't change the meaning of any code inside.
Oct 13 2008
Sorry if I haven't made myself clear enough. The main issue i'm worried about is memory leaks. I need to make sure the dll can be used by multiple threads and the gc be aware of each thread's memory. On Tue, 14 Oct 2008 12:41:42 +1300, Christopher Wright <dhasenan gmail.com> wrote:Tim M wrote:So do I just have to use C/C++ and is there any plans / current projects that this may change in future?No, you just have to do this: extern (Windows) { // The application calls this void someDllFunc () { // regular D code here } } void someNonDllFunc () { // The application doesn't see this. } extern (Windows) tells the compiler to disguise the functions so they look like regular C functions in the resulting object file. It doesn't change the meaning of any code inside.
Oct 13 2008
Christopher Wright wrote:extern (Windows) tells the compiler to disguise the functions so they look like regular C functions in the resulting object file. It doesn't change the meaning of any code inside.Not quite. That would be extern(C). Using the Windows version will give you a function with the stdcall calling convention, which changes the order in which parameters are passed on the stack in a function call. Not a good idea to use in the general case.
Oct 14 2008
Mike Parker wrote:Christopher Wright wrote:Groovy, thanks. I use Linux, and even there I don't use extern; thus my ignorance.extern (Windows) tells the compiler to disguise the functions so they look like regular C functions in the resulting object file. It doesn't change the meaning of any code inside.Not quite. That would be extern(C). Using the Windows version will give you a function with the stdcall calling convention, which changes the order in which parameters are passed on the stack in a function call. Not a good idea to use in the general case.
Oct 14 2008