From: Andrew R. <and...@us...> - 2008-10-09 19:39:54
|
On Thu, Oct 09, 2008 at 09:09:47PM +0200, Werner Smekal wrote: > Hi Andrew, > > > > This may not be quite the right long term solution. Language bindings > > for example might be importing some symbols from the core library and > > exporting others to the user. Similarly for drivers. > > Sure. Ok, I rephrase: this is the correct solution as it was initially > considered, but since plplot is a little more complicated, we need to > adjust that (in the long term). > > > > I'm not quite sure why things work at the moment. I suspect it is > > because the import is optional. We should probably try to fix this > > though to make it really clear whether we are importing or exporting. > > > > I did this for the drivers - they use PLDLLEXPORT in the source because > > they only every export symbols to the core library. The imports are > > defined elsewhere. > > This is something, what should be decided by the cmake and not by the > source/headers files. So if xxxMAKINGDLL is defined, xxxIMPEXP is > defined to export symbols, if USINGDLL is defined, xxxIMPEXP is defined > to import symbols. For the core library its easy, we always export > (still we should use DLLIMPEXP). For the examples it's also easy we > always import. For the bindings, it's more complicated since we export > symbols, but also import symbols from the core. Drivers are also a > different story. > > I suggest that we use the macro cmake defines at compile time for shared > libraries. if you run "make VERBOSE=1" for the shared libraries you will > see that a macro like "-Dplplotd_EXPORT" is defined. So we always know, > what is built in the moment, and set DLLEXPIMP to export. I hope that > this will also be set for the drivers. We then don't have to worry about > defining MAKINGDLL at the correct time. > > This is something we have to investigate further. It's not quite a cmake issue since we need xxxMAKINGDLL for the driver source file and xxxUSINGDLL for the core header files included by the source file. At the moment these are mutually exclusive so we can't do it with just cmake options. It will require some source code changes as well, or a change to the way we use the defines. So far as I can see we only need DLLEXPIMP for the header files which are used both for making the library and using it. Andrew |