[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
FAQ 10.4: How do I build a DLL using Cons?
From: |
Vaclav Barta |
Subject: |
FAQ 10.4: How do I build a DLL using Cons? |
Date: |
Sun, 17 Feb 2002 10:04:15 +0000 |
Hi,
I finally got to writing it down, but of course I've made some little
changes in the process, and I can't check the final
version because I don't have access to Visual C++ any more... So
(as always) use at your own risk, and I don't think
the instructions should go into the FAQ until somebody tries to follow
them...
Bye
Vasek
10.4. How do I build a DLL using Cons?
You can build a DLL with a Library command, but the command
requires some custom variable settings in its construction
environment, primarily how to compile:
CXXCOM => "%CC %CXXFLAGS %_IFLAGS /TP /c %< /Fo%>"
(note that this is for a C++ project; straight C compilation
would use CCCOM) and how to link:
ARCOM => "%CC %CXXFLAGS %_IFLAGS /LD /Fe%>:b %<"
(note the :b suffix; the Microsoft linker is usually passed
the full name - including the .dll extension - but seems
equally happy without it, and cons is much happier that
way).
The compiler switches in the commands above are for Visual C++
- see its documentation for their description (and if you're
using another C/C++ compiler, note that it'll very probably have
the same functionality, but with a different syntax). You'll
also need to specify (at least) CPPPATH (see FAQ 6.6), CXXFLAGS
(see below) and ENV. With an environment like that, simply
putting
Library $env "#output\\package1", qw(modulea.cc moduleb.cc);
into your Conscript file (in, say, package1
directory) will build package1.dll (in
output directory) from modulea.cc and
moduleb.cc.
Note that the example above does not have separate debug
vs. release builds (although it can be extended for that - see
also FAQ 7.4), Windows resources (I did not try those) and does
not use the .def file. The last choice means that
__declspec(dllexport)
must be used when declaring
functions exported from package1.dll in
package1 (and __declspec(dllimport)
when
declaring them in the DLL's clients); the preprocessor directive
controlling the linkage specification (say,
/DPACKAGE1DLL
) goes to CXXFLAGS.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- FAQ 10.4: How do I build a DLL using Cons?,
Vaclav Barta <=