static link library question
| Wed, 2004-06-09 13:05 | |
|
Hi group,
Let me ask a trivial linking question! I have a static link library which is supposed to be use by others developers, my MMP file looks is as follows: Code: TARGET mydll.dll TARGETTYPE dll UID 0x1000008d 0x01000218 SOURCEPATH . SOURCE mydll.cpp SOURCE ClassA.cpp SOURCE ClassB.cpp USERINCLUDE . USERINCLUDE ..\inc SYSTEMINCLUDE \Epoc32\include LIBRARY euser.lib insock.lib esock.lib ClassA must be known to the user of the library, but I don't want to provide it's implementation (cpp)! How can i force compiled code for class ClassA to be be linked into the mydll.dll?? So the user can simple include mydll.h file. cheers, M. |
|






Forum posts: 52
Then when you build the library (once you've frozen it) you will get a .lib file which others can link against - they will be able to use the functions of ClassA.
Think hard about the interface for ClassA, cos you're pretty much stuck with it once you've exported it that way (unless you break Binary Compatibility).
I'm not convinced that I understood your question properly but I thought I'd give it a go anyway...
Forum posts: 15
My bld.inf is quite simple:
// Component description file
//
PRJ_MMPFILES
mydll.mmp
Forum posts: 52
myheader.h \epoc32\include\myheader.h
I think you might even be able to abbreviate this to:
myheader.h
A the code in the dynamic link library will not become part of the users executable, just the interface that is in the LIB that gets created for your DLL is linked into the user executable.
This is actually a Static Interface DLL, the lib is the import library, but the executable is loaded at run-time.
A static link library is not an executable, just code that gets statically linked into the user executable, i.e. the code becomes part of their executable.
I'm not entirely sure how you create a static link library in Symbian. My guess would be TARGETTYPE lib in the bld.inf.
You need to determine which is the best method for your needs. The usual way in Symbian is to use dynamic link libraries rather than statically liked libraries, to keep the code size to a minimum seen as were working with limited resources.
I hope this helps.
Forum posts: 52
So the word 'static' is used for something else in Symbian OS. You have either static DLLs or polymorphic DLLs.
minstn is trying to write a static DLL. That means it has a variety of exports which can be used by other apps. He's on the right lines.
The other type, polymorphic DLLs, are used for plug-in architectures. They generally have a single export which constructs a subclass of some type. For example, .APP files are polymorphic DLLs. They have a single export which creates a subclass of CEikApplication.
Forum posts: 23
I'm not incredibly familiar with the low level details of Symbian, but...
How is a .o file that is a component of a build different from a statically linked library loaded into code at build time? If I provide a .o file and a header, somebody can link my code at build time and it'll all be one big happy executable...
I am using the UNIX/GCC toolchain, so it may be that I can do things using this toolchain that others can't do, but just about every build environment I've ever used works that way.
Forum posts: 52
Firstly, what you refer to as a "static DLL" is correctly termed a "static interface DLL". To say "static DLL" is to say "static dynamic link library", clearly a contradiction of terms. Read the section titled "Frameworks, libraries and DLLs" in the Developer Library for more information.
Perhaps the version of Symbian you are working with differs to mine (7.0s), but I certainly can statically link. On my current project, I have a static link library (.lib) with no associated DLL that I statically link into my executable.
In fact, with a little modification I managed to build (against my better judgement, but rather as a proof-of-concept for a manager) that a third-party developed static interface DLL for which I had the source could in fact be built as a static link library, linked and executed successfully.
bhima is correct in drawing the comparison with the intermediate ".o" files. There really isn't any significant difference in the way these and static link libraries are linked. I agree also that every C/C++ environment I have worked with also behaves in this way: you compile, you link.
It seems Symbian don't go to any length to inform developers how to generate static link libraries, perhaps this is to promote the use of shared library DLLs.
Forum posts: 52
can you give me some ideas on how to build a DLL into static link library? i badly need this.
tnx very much in advance.
Firstly, what you refer to as a "static DLL" is correctly termed a "static interface DLL". To say "static DLL" is to say "static dynamic link library", clearly a contradiction of terms. Read the section titled "Frameworks, libraries and DLLs" in the Developer Library for more information.
Perhaps the version of Symbian you are working with differs to mine (7.0s), but I certainly can statically link. On my current project, I have a static link library (.lib) with no associated DLL that I statically link into my executable.
In fact, with a little modification I managed to build (against my better judgement, but rather as a proof-of-concept for a manager) that a third-party developed static interface DLL for which I had the source could in fact be built as a static link library, linked and executed successfully.
bhima is correct in drawing the comparison with the intermediate ".o" files. There really isn't any significant difference in the way these and static link libraries are linked. I agree also that every C/C++ environment I have worked with also behaves in this way: you compile, you link.
It seems Symbian don't go to any length to inform developers how to generate static link libraries, perhaps this is to promote the use of shared library DLLs.