www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - DLL Creating/Loading with D

Does anyone have a minimal, end-to-end example of:

1) A D DLL that implements a single function
2) A D application that links to that DLL and calls that function

I see a lot of scattered talk about DLLs, but it mostly focuses on how to:

- Create a D DLL for linking with another language
- Linking a DLL written in another language into a D application

I'm a bit new to DLLs, so I'm easily confused.  Thus I'm looking for the
simplest example that shows creating and using a DLL, all using D.  Basically, I
get DLL's at a high level, but I'm stuggling to get understand the precise
mechanics of "who does what" when:

- Reading instructions from disk and loading into RAM
- Routing calls to the appropriate memory addresses in the newly-loaded code

Is this something done by the OS (and thus requires calling the Win32 API), or
is it something handled by the language/compiler/linker itself?

As you can see, I'm a little confused where to start, and any help would be
appreciated.  Thanks!

Jun 02 2004