×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Regular Contributor
    Join Date
    Oct 2003
    Posts
    121

    Angry How can export static const member from dll?

    How can export static const member from dll? As follows:

    //DLLClass.h
    class IMPORT_C CMyDLL
    {
    public:
    IMPORT_C CMyDLL();
    IMPORT_C int getData();
    IMPORT_C void setData(int d);

    static const int SSData;
    private:
    int iData;
    };


    //DLLClass.cpp
    #include "DLLClass.h"
    GLDEF_C TInt E32Dll(TDllReason )
    {
    return(KErrNone);
    }
    EXPORT_C CMyDLL::CMyDLL()
    {
    iData = 0;
    }
    EXPORT_C int CMyDLL::getData()
    {
    return iData;
    }
    EXPORT_C void CMyDLL::setData(int d)
    {
    iData = d;
    }

    EXPORT_C const int CMyDLL::SSData = 10;

    After freeze, the WINS.def don't list "CMyDLL::SSData", and ARM.def can export "CMyDLL::SSData". It can success to link the dll of ARM. But when the App call CMyDLL::SSData, the App aborts.
    How can do this?
    Thanks!


    Alex

  2. #2
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Budapest, Hungary
    Posts
    28,572

    Re: How can export static const member from dll?

    I have no real idea, however you have no IMPORT_C for SSData in the header. And there is always a choice of providing a getter method instead of exporting a constant/variable.

  3. #3
    Registered User
    Join Date
    Dec 2006
    Posts
    2,280

    Re: How can export static const member from dll?

    I don't understand why you want to do this.

    However, if you have a static constant data entry in the dll then why not just replace it with a #define value in the interface header (unless it's for a dll version or something like that)?

    Or, if you really want provide a getter method as wizard_hu_ suggests.

    Sorcery

Similar Threads

  1. GoogleIt
    By deepika.mangla in forum Symbian
    Replies: 5
    Last Post: 2011-05-28, 11:04
  2. Fail to build syexpat 1.3 under 2nd FP3
    By harry_zhang in forum Symbian
    Replies: 10
    Last Post: 2010-03-19, 10:24
  3. SyExpat + problem + memmove + Carbide Express
    By pearman in forum Symbian
    Replies: 2
    Last Post: 2006-10-14, 22:21
  4. Linking Static DLL with another Static DLL
    By symbianfresher in forum Symbian
    Replies: 6
    Last Post: 2006-01-09, 04:23
  5. Cannot compile SDK's examples for 7650 platform...
    By midletsoft in forum Symbian Tools & SDKs
    Replies: 2
    Last Post: 2003-08-12, 19:11

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •