
To make my singleton work with dlls, I have determined that I need to export/import certain global lifetime management objects so that they are visible across dll boundaries. To keep the library header-only, I want to use the preprocessor to detect whether a windows dll, windows exe, or other is being built. If it is a windows exe I want to export the object. If it is a windows build and not an exe, I want to import the object. And if it is not a windows build I just want to define the object normally. A couple questions since this is unfamiliar territory for me: Can I export from an exe and import into a dll? It seems like normally the reverse would be done, but this seems like a good way to ensure that the object is only exported once. What boost macros would I use to detect which type of build is occurring? Is there any type of exporting or importing that should occur with the Linux equivalent of dlls? If so, is there some uniform interface provided by boost that wraps things like __declspec(dllexport) and __declspec(dllimport) for most platforms? -Jason
participants (1)
-
Jason Hise