473,473 Members | 1,906 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

C DLL not work in Windows Service but works fine from Console app


We're using a 3rd party C DLL in a project that we don't have source
for. When we call the DLL from a console app everything works fine.
However, when we call it from a Windows Service, the DLL doesn't work
(sorry, can't be more descriptive.. no errors, but no results).

We've even taken the exact Windows Service project and put code in
main() to instantiate the service and call OnStart() instead of going
through the service base class. When we do that, it works fine (it's
essentially a console app at that point). There's something related
to the app running as a Windows Service causing problems for the 3rd
party dll.

Of course we'll try to follow up with the C authors but in the
interim... What kinds of things can cause problems in a windows
service as compared to a console app? What's different about the
environment or threading model or whatever? It's just a plain C DLL
that exports some functions and performs a bunch of complex
calculations on 40mb or so of data it stores in memory. It doesn't
interact with anything outside the DLL and doesn't use COM.

The service is run with the same user credentials as our logged in
user.

Thanks,

Sam
Nov 17 '05 #1
1 3370

Turned out the problem was related to the current directory. The C
DLL loaded a text file from the current directory but when run as a
windows service that was always "c:\windows\system32". We set
Environment.CurrentDirectory to the directory of the exe in OnStart
and that fixed the problem.

Thanks,

Sam

On Wed, 18 May 2005 16:45:30 -0400, Samuel R. Neff
<in**********@newsgroup.nospam> wrote:

We're using a 3rd party C DLL in a project that we don't have source
for. When we call the DLL from a console app everything works fine.
However, when we call it from a Windows Service, the DLL doesn't work
(sorry, can't be more descriptive.. no errors, but no results).

We've even taken the exact Windows Service project and put code in
main() to instantiate the service and call OnStart() instead of going
through the service base class. When we do that, it works fine (it's
essentially a console app at that point). There's something related
to the app running as a Windows Service causing problems for the 3rd
party dll.

Of course we'll try to follow up with the C authors but in the
interim... What kinds of things can cause problems in a windows
service as compared to a console app? What's different about the
environment or threading model or whatever? It's just a plain C DLL
that exports some functions and performs a bunch of complex
calculations on 40mb or so of data it stores in memory. It doesn't
interact with anything outside the DLL and doesn't use COM.

The service is run with the same user credentials as our logged in
user.

Thanks,

Sam


Nov 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Dan | last post by:
All, I have a windows service that creates a couple of worker threads to do some processing. The service works fine. However, the main service thread has a method for sending email notices that...
9
by: SP | last post by:
Hi All, I wrote a windows service which is supposed to stop after specified amount of time. I am calling OnStop() after specified time. OnStop() methods executed but I dont see the service...
4
by: Graham Siener | last post by:
Hi All, I have a real confusion situation on my hands. I've written a windows service in c# that basically does archiving of data from one database to another. Along the way it parses one...
6
by: carbon_dragon | last post by:
Ok, so here is the problem. I'm working on a headless server program implemented as a .NET C# Console project. There is a UPS mounted to this server (though not a windows compliant UPS). I can only...
0
by: Seth | last post by:
For some reason my service works fine except that it will create the file in my c drive, but will not write to the file. Sorry if this is a duplicate post, i have found some that ask the same...
2
by: Chris Mullins | last post by:
For some reason the question, "Can I make an EXE that is both a Windows Service and a Console Application?" has come up quite a bit for me over the last few weeks. I've been doing this for...
1
by: steakhaus | last post by:
I just put up a new website that won't work in Firefox, but works fine in Safari. Are there any known problems? I designed it in Dreamweaver and the navigation bar has flash buttons that should...
7
by: GD | last post by:
Hi, I am trying to call a webservice from a windows service application. It works only if I launch the windows service app from VS.Net 2005 (Worked around from Main()) or from a winform test...
1
by: kirk.quinbar | last post by:
Have you ever used a .net deployment project to install a windows service? If so, then i ran into an issue recently that maybe you could shed some light on. I am sure I probably did something...
1
by: Gx3r0 | last post by:
0I have a windows service I created that checks for data to post to an off site webservice over SSL. The service checks every 10 seconds for data to send, if there is data it opens a connection to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.