PDA

View Full Version : QtService and GAC loadable dll



stevey
16th July 2006, 08:49
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:


#ifdef SERVICE1_LIB
# define SERVICE1_EXPORT Q_DECL_EXPORT
#else
# define SERVICE1_EXPORT Q_DECL_IMPORT
#endif

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

wysota
16th July 2006, 10:32
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.

stevey
16th July 2006, 12:19
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 :o
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

stevey
17th July 2006, 04:39
Actually I just discovered that the GAC has only been around since .net :o
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