Results 1 to 4 of 4

Thread: QtService and GAC loadable dll

  1. #1
    Join Date
    Mar 2006
    Posts
    140
    Thanks
    8
    Thanked 4 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QtService and GAC loadable dll

    Hi,

    I'm trying to come up with a good solution for a project where I'm aiming at using a component based architecture.
    I done this under Win32 using C# to create .net assemblies which are just dlls which can be loaded into the Global Assembly Cache (GAC) the regsitered as a system service.
    I'm assuming that Linux offers this in the form of Daemons although I imagine the approach is a little different.

    I was hoping that the QtService solution provided on the Trolltech site would help to produce the correct dll type.
    I've manged to create a dll called Service1 which subclasses from QtService<QCoreApplication>. It compiles fine, and I'm sure that compiling under linux would give me an equivalent .so file.

    The bit that I see as being different is that the dll should have a bunch of extra symbols and win32 interfaces implemented automatically that allow the dll to be loaded into the gac and registered.
    This doesn't seem to be the case though.
    I tried 'gacutil /i Service1.dll' but I just get the message "An attempt was made to load a program with an incorrect format.'

    service1_global.h (generated as part of the project by VS integration) defines the following:
    Qt Code:
    1. #ifdef SERVICE1_LIB
    2. # define SERVICE1_EXPORT Q_DECL_EXPORT
    3. #else
    4. # define SERVICE1_EXPORT Q_DECL_IMPORT
    5. #endif
    To copy to clipboard, switch view to plain text mode 
    Q_DECL_EXPORT is a QT macro for __declspec(dllexport) which is standard windows dll guff, and my guess is that I need to stick some other macros in which will export the symbols needed for this to qualify as a GAC'able dll.

    Has anyone gone down this path before?
    ( And worked it out )



    Thanks,

    Steve York

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QtService and GAC loadable dll

    The QtSolution probably comes with some example use of the component. Did you check if you can register the example service into the cache? Maybe QtService doesn't provide such a functionality (I admit I'm totally lame when it comes with Windows Services so I may be saying something stupid here). Most people here don't have access to QtSolutions so our help is limited. It would probably prove best if you sent a mail to Trolltech asking for advice if you don't come up with a solution yourself. In any way, we'll try to help you to the best of our abilities.

  3. #3
    Join Date
    Mar 2006
    Posts
    140
    Thanks
    8
    Thanked 4 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QtService and GAC loadable dll

    Hi,

    Thanks for the reply.
    I tried 'gacutil /i Service1.dll' but I just get the message "An attempt was made to load a program with an incorrect format.'
    I also tried 'regsvcs Service1.dll' but got the same message.

    The examples in the docco are actuall pretty lame to be honest, and really don't cover what I need to do.
    in essence I could create a standard service as a .exe but as far as I know, this doesn't get as far as the Enterprise Service Components can get.

    Since writing my initial post I tried the extra fraught with danger ATL
    An ATL service (dll) with COM+1.0 support also didn't register.
    It had method attributes auto inserted as well.
    The 'module' attribute meant that the RegisterServer, etc symbols would automatically be done for me, so I know I didnt' have to worry about those.

    My guess is there's something more insideous that needs to be added.
    Unfortunately, the fact I use C# exculsively at my day job means I don't ever have to worry about the back end stuff.
    .net takes care of it all.
    Rapid dev is good in principle, but it deffo prevents the development of real knowledge, oh well.

    Anyway, what I'm trying to do, may not be achievable using straight Qt, but I'd like to at least find out in simple terms how this could be achieved within a platform independent framework.
    I ultimately need to be able to compile these assemblies up as both a .dll and .so.
    These dudes will basically be 'worker' classes that I want to have respond to messages from a centralised broker, and have the capacity for scaling the system up and adding more of the same type of worker with as little hassle as possible.

    If anyone has already done this type of thing in a platform independent way in Qt, please let me know

    I'll contact the trolls if I don't hear anythign from this forum.
    Thanks,

    Steve

  4. #4
    Join Date
    Mar 2006
    Posts
    140
    Thanks
    8
    Thanked 4 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QtService and GAC loadable dll

    Actually I just discovered that the GAC has only been around since .net
    So this bit at the very least isn't really isn't needed and I can just skip straight to the COM side I guess.

    Anyway, if anyone can offer any guidance, I'd be much obliged.


    Steve

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.