[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

6.2

URGENT Whats wrong with this ATL COM DLL???

Asked by adamretter in C++ Programming Language, Microsoft Programming, Microsoft Visual C++

I have created an ATL COM DLL using the New Project Wizzard in Microsoft Visual Studio 6. Called Webcounter.

I have added a Simple ATL Object called Counter and also added two functions called Increment and GetCount.

When I comile this Project as a "Debug Release" it compiles fine but, when i try to compile it as any sort of "Release" version the compiler gives me this error.

LIBCMT.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
ReleaseMinDependency/WebCounter.dll : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

Howvever if i add -
void main()
{
}
to webcounter.cpp it compiles fine, why is this it already has a DllMain Why do i need to add void main to make it compile and why does the wizzard not do this, or should i not be doing this and is the problem elsewhere.

NOW THE MAIN PROBLEM?
=====================
I am Calling this ATL COM DLL from an Active Server Page (ASP) on my webserver using -
Set myObj = Server.CreateObject("Webcounter.Counter")

Which works fine, this object then appears to work fine for several consecutive calls until however it crashes the webserver (IIS4 on NT4 SP6a). Why does it crash, am I leaking memory here or are any of the Windows calls i make NOT threadsafe, as I understand that calls from a Mutiluser COM DLL need to threadsafe ? (Dont they? Im sure ive been told this?)

If anyone wants the full source code so they can
understand my problem look here
http://www.dynamic-server.net/atlwebcounter-src.zip
Else listed below is the source code of my two functions.



STDMETHODIMP CCounter::Increment(BSTR strPage, BSTR strFilename, BOOL *bResult)
{
     _bstr_t bstrPage(strPage, FALSE);
     _bstr_t bstrFilename(strFilename, FALSE);

     //Open Count
     int iCount = GetPrivateProfileInt("Users", (char*)bstrPage, -1, (char*)bstrFilename);
     if(iCount <= 0)
     {
          //File does not exist or could not find key entry
          iCount = 1;
     }
     else
     {
          //Increment Count
          iCount++;
     }

     //Save Count
     char  cCount[10] = "\0";
     itoa(iCount, cCount, 10);
     
     if(WritePrivateProfileString("Users", (char*)bstrPage, cCount, (char*)bstrFilename) == 0)
     {
          *bResult = FALSE;
     }
     else
     {
          *bResult = TRUE;
     }

     return S_OK;
}

STDMETHODIMP CCounter::GetCount(BSTR strPage, BSTR strFilename, int *iCount)
{
     // TODO: Add your implementation code here
     _bstr_t bstrPage(strPage, FALSE);
     _bstr_t bstrFilename(strFilename, FALSE);

     //Open Count
     *iCount = GetPrivateProfileInt("Users", (char*)bstrPage, -1, (char*)bstrFilename);

     return S_OK;
}
[+][-]02/19/02 08:41 AM, ID: 6810999Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02/19/02 08:44 AM, ID: 6811004Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02/19/02 08:48 AM, ID: 6811012Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02/19/02 09:49 AM, ID: 6811134Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02/19/02 09:49 AM, ID: 6811137Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02/19/02 10:09 AM, ID: 6811200Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02/19/02 10:14 AM, ID: 6811216Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02/19/02 10:18 AM, ID: 6811225Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02/19/02 10:19 AM, ID: 6811230Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02/19/02 10:21 AM, ID: 6811237Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02/19/02 10:21 AM, ID: 6811240Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02/19/02 12:18 PM, ID: 6811538Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02/19/02 02:46 PM, ID: 6811855Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02/19/02 03:13 PM, ID: 6811924Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02/20/02 02:40 AM, ID: 6812871Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02/20/02 05:32 AM, ID: 6813082Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02/20/02 05:59 AM, ID: 6813148Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02/20/02 08:02 AM, ID: 6813482Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02/20/02 08:42 AM, ID: 6813561Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02/20/02 09:58 AM, ID: 6813779Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02/20/02 10:09 AM, ID: 6813831Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02/21/02 10:26 AM, ID: 6816922Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02/27/02 06:00 AM, ID: 6829631Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03/05/02 06:22 AM, ID: 6841555Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zones: C++ Programming Language, Microsoft Programming, Microsoft Visual C++
Sign Up Now!
Solution Provided By: jkr
Participating Experts: 2
Solution Grade: A
 
[+][-]03/05/02 08:33 AM, ID: 6841884Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03/05/02 06:16 PM, ID: 6843191Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03/07/02 10:42 AM, ID: 6848045Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03/07/02 05:51 PM, ID: 6849202Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-89