May 31, 2013
Hello. How do I make a library from D? I see the dmd --help output give a -lib option but am not sure how to actually use it. Can I produce a library and then just import it by its name? (This is an offshoot of my previous query about the proprietary lib thing.)

And given that http://dlang.org/cpp_interface.html talks about compiling a C++ file with a C++ compiler and a D file with a D compiler and then linking the two together, do I understand something like:

clang -c cpplib.cpp
dmd -c dprog.d
ld -o d-cpp-joint-venture cpplib.o dprog.o -lm

What do I do to create a sharedlib/staticlib which would have both C++ and D objfile components? Is it the regular:

ld -shared -o $(SHAREDLIB) $(OBJFILES) -lm

and

ar r $(STATICLIB) $(OBJFILES)
ranlib $(STATICLIB)

IOW, after dmd finishes compiling, it is just like any other object file on my platform?

Thanks as ever for your patience!

-- 
Shriramana Sharma ஶ்ரீரமணஶர்மா श्रीरमणशर्मा
May 31, 2013
On Fri, 31 May 2013 12:26:54 +0100, Shriramana Sharma <samjnaa@gmail.com> wrote:

> Hello. How do I make a library from D? I see the dmd --help output
> give a -lib option but am not sure how to actually use it. Can I
> produce a library and then just import it by its name? (This is an
> offshoot of my previous query about the proprietary lib thing.)
>
> And given that http://dlang.org/cpp_interface.html talks about
> compiling a C++ file with a C++ compiler and a D file with a D
> compiler and then linking the two together, do I understand something
> like:
>
> clang -c cpplib.cpp
> dmd -c dprog.d
> ld -o d-cpp-joint-venture cpplib.o dprog.o -lm
>
> What do I do to create a sharedlib/staticlib which would have both C++
> and D objfile components? Is it the regular:
>
> ld -shared -o $(SHAREDLIB) $(OBJFILES) -lm
>
> and
>
> ar r $(STATICLIB) $(OBJFILES)
> ranlib $(STATICLIB)
>
> IOW, after dmd finishes compiling, it is just like any other object
> file on my platform?
>
> Thanks as ever for your patience!

Have you seen this:
http://dlang.org/dmd-linux.html#library

R

-- 
Using Opera's revolutionary email client: http://www.opera.com/mail/