Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Developing U++ » U++ Developers corner » Build UPP modules into DLL with import library
Build UPP modules into DLL with import library [message #7369] Sat, 23 December 2006 16:25 Go to next message
wang.xuan is currently offline  wang.xuan
Messages: 2
Registered: December 2006
Junior Member
I am a newcomer in UPP community. I got acquaintance with UPP in this weekend. It maybe the most amazing GUI library I have meet.I found many people says that in this forum.Smile

Many fresh user like me may quickly go into one problem that is how to compile UPP modules into DLL. After searching the forums, I found that there seems no one had post a functional solution.

I tried a whole day for this issue and finally I got a release of theIDE with all dependent modules compiled into DLLs.

I summarized the findings as below. Though UPP mainly focuses on static linking, I hope the community can take Dynamic-linking into more consideration. Despite the advantages of static linking that were described by UPP team, dynamic linking really encourage the usage of it.

Steps to make UPP dynamic linking:
1. Open "Output Mode" dialog, to uncheck "BLIZ" check box, select link mode as 'all shared'.
2. Resolve some dependency problem in "Package Organizer". Because static linking in default UPP build setup, the dependency seems not so serious. But when dyamic linking is used, problems arise.
For example, originally package 'Draw' use 'Plugin\bmp'. In fact the relationship is in reverse direction. So remove 'Plugin\bmp' from 'Draw' , add it to 'Ide', and then add 'Draw' to 'Plugin\bmp', or it will lead link error. Similar dependency problem exist in a few package. But it is easy to find it if you really try the compiling. (I forgot to make not when do the fixing, so I have no the list of the places need to change unless I download one UPP again and compare it. Any way, it is easy.)
3. Resolve export problem of static class data member.
UPP has a very nice feature in WIN32 when using MSVC compiler that is parsing COFF of obj files to automatically generate def file. This function eliminate the need to write ugly dllimport and dllexport in headers.
I use a MSVC8+sp1 compiler. After I have done steps 1&2, I got further error when linking CtrlLib. It complained unresolved symbol of "Draw::AStdFont",that is a static class data member.
I used dumpbin.exe to check the linkage of this memeber for DrawText.obj. It is static linkage. I am not familiar with C++ standard, but I realized that it is so strange in M$'s solution. All static function for a class is extern linkage, but not yet for the static data member.
I have not tried to change Line39(if(sym.StorageClass == COFF_IMAGE_SYM_CLASS_EXTERNAL) in MSCBuilder.cpp in package
'Ide\builder'. I do not think it should be useful.
I changed 'Draw.h', changed the static member function 'GetStdFont' from inline to normal function definition in DrawText.cpp, because 'AStdFont' is acturally used in this function's body.
This solution is functional but if derived class need to access super's static data member, it is need to use some static get/set function for that member. Any way, it is function. There are several files need this fix. Like in Step2, I have no list now. If anyone is interest in it, I will paste it later.

---That is all I have done. I use MSVC8+sp1 on win with UPP612dev2. I think it will be similar in other platforms.

I don't know whether UPP team will consider dynamic linking in the future release. I hope this. As the code evolving, this solution may be impossible to apply as the size may become bigger and bigger.
Re: Build UPP modules into DLL with import library [message #7370 is a reply to message #7369] Sat, 23 December 2006 16:32 Go to previous messageGo to next message
wang.xuan is currently offline  wang.xuan
Messages: 2
Registered: December 2006
Junior Member
The output package contains theIDE.exe and dependent dlls has a size of about 6.5M. After compressed, it is about 2.5M.

The result seems not so bad.
Re: Build UPP modules into DLL with import library [message #7378 is a reply to message #7369] Mon, 25 December 2006 08:31 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
wang.xuan wrote on Sat, 23 December 2006 10:25



I don't know whether UPP team will consider dynamic linking in the future release.




Well, I think that support is already there, in TheIDE. But thanks for finding all related troubles of current release, we had it on ToDo list.

Anyway, as for broader support, I have even wider ideas:

http://www.ultimatepp.org/forum/index.php?t=msg&th=1774& amp;start=0&

(which involves dynamic linking as well).

Mirek
Previous Topic: Database portability: Sqlite3
Next Topic: About string, String and const char *
Goto Forum:
  


Current Time: Sun May 05 21:29:06 CEST 2024

Total time taken to generate the page: 0.01844 seconds