PlayKid
PlayKid

Reputation: 871

64bits Windows Service but require a 32bits dll

I need to write a 64bits Windows Service, however, it is not possible due to I am using a 32bits dll, I am thinking of writing 2 services, one extracting information from the 32bits dll, and then pass the variables to the 64bits Windows service.

But I have no experience of doing that, and when I tried to Google 32bits and 64bits, it returns plenty of website, but none of them can be used. So please assist me if possible.

The reason for me to write 64bits Windows Service is because the data size is too huge, minimum 5Gb of data produced after the calculation/procedure finished, but to get the initial data, I need to use a 32bits dll.

Thanks alot

PlayKid

Upvotes: 2

Views: 1333

Answers (3)

slugster
slugster

Reputation: 49984

I need to write a 64bits Windows Service

Why does it need to be 64bit? A 32 bit service will run quite happily under a 64 bit version of Windows. You should only compile to 64bits if you need to specifically use 64bit features or a library you are using is already compiled to 64bit, as you will get neglible to no benefits from doing this otherwise.

If you must compile to x64 then you will need to use some inter-process communication like you mentioned. I presume you have already checked that the target dll is specifically x86, and it isn't a .Net assembly that is compiled to AnyCPU? You could consider having a x64 WCF service hosted on the same machine which then receives the info from a x86 Windows service.

Upvotes: 2

Davide Piras
Davide Piras

Reputation: 44605

I think you can write one service only targeting x86 or anyCpu then in deployment on the x64 server you should configure it to run in 32 bit mode only. that should work with no need to create or build 2 of them :-)

Edit: PlayKid, I am not sure I got your point or made wrong assumptions, I think you only need one service and host in in x32 mode because of the 3rd party 32bit dll which works only if hosted in a 32 bit process, so I think you can build a normal .NET service, host it in 32 bit mode even in a x64 server and it will work and no need to make two services and make them communicate to each other. Edit your question if you have more details and this answer does not help you ;-)

Upvotes: 2

Yahia
Yahia

Reputation: 70369

what you describe is not really specific to 32 versus 64 Bits...

It is about having 2 Windows Services communicate which you can do by any IPC mechanism... A very fast one would be to use shared memory (a global Mutex and a MemoryMappedFile)... another one would be TCP/IP which would allow for possibly running the services on separate machines in the future... another option would be to host a WCF service with a well-defined interface etc.

Upvotes: 3

Related Questions