=?UTF-8?B?RXJpayBXaWtzdHLDtm0=?= <Er***********@telia.comwrote in
news:im*****************@newsb.telia.net:
You are right about this not being a C++ question, so for future
questions regarding DLLs please use a more appropriate group (I think a
win32 programming group would be the right choice). Here is a tutorial
to get you started: http://www.codeproject.com/dll/RegDLL.asp
I think ghetto-izing shared library implementation should be discouraged.
Instead, consider ways to design sharable libraries that can be used on
many platforms (not just Win32). For example, is there any standardization
effort in creating syntactic linkage hints such as this kind of
import/export decorator?
For example, right now I'm working on a proprietary closed-source library
that's initially implemented as a Win32 DLL but I'd like to design it so
that it can be easily rebuilt on Linux, Solaris, Mac, etc. What's the best
way to structure one's code to accomplish that?
My approach has been to create an auxiliary header (<MyLibrary/_internal.h>
) that gets included in each public header and defines linkage macros that
get used for each class and function that needs this.
I put my headers in project/include/MyLibrary, and library clients add
project/include to their -I option. This allows me to use simple names for
headers and keeps them in a separate #include namespace. (Perhaps
project/include/Vendor/Library) would be preferable, if a vendor produces
several libraries.)
My biggest hassle so far in portable shared libraries is the use of STL
objects (particularly containers) in public classes. The MS compiler will
whine that those classes need DLL linkage. Is gcc under Linux subject to
the same problem? How can I design the classes so that I don't face this?