Security Software review and downloads
  • Home
  • Spyware & Spyware Remover
  • Registry & Registry Cleaner
  • Firewall
  • Hacked
  • Uninstall & Uninstaller
  • Antivirus

C++ thread calling dll function help!?

August 16th, 2008 · 3 Comments

Very quickly:
I have a C++ program, it calls a dll that contains some external functions through a *.h & *.lib (meaning I don’t have the source).

So, I want to add threading. So I use AfxBeginThread and try.
When my thread calls a certain function say “foo(ptr)”. It returns a valid response, but the value of “ptr” is supposed to be changed — its not.

But same code, simply called from the main-thread works — ptr is the proper value.

Is there a reason why a thread wont work correctly with an external dll ?

Related posts:

  • C++ Calling a DLL function?
  • How do you call a dll function in C++. Meaning the block of code, and maybe a quick...
  • i forgot my security code for nokia 6030… my IMEI number is 358354008312901… pls help!!?
  • master reset code or anything that will unlock it would be awesome!! thanks!!! i have...
  • Calling a local function in the same exe Vs one in a dll?
  • Im developing a mobile application that runs on Windows CE and runs on a PSION device...
  • Why wont Nero 8 uninstall?
  • I get an Internal Error message when I try to uninstall it. I get the message...
  • External 500 gig H.D. . Needing to transfer Mcafee, Symantec, etc. to external . . . .
  • Not possible? Need kernels? Symantec wants another subscription to simply MOVE their...
  • VOIP for MAC OS X.?
  • Hi! I am looking for a VOIP software for MAC OS X. I have looked at Skype, Gizmo5, Joi...
  • How do I “post a new thread” in blackboard using Internet Explorer with Windows Vista?
  • For my school I am using "Blackboard" in order to communicate, collaborate, with...
  • how can i retreive my router password on a netgear wgt624 v2?
  • is there anything i can do? i dont want to reset my router because i'll have to...
  • My AVG Free 8.0 Anti-virus hasn’t find a thread in a while….?
  • I don't remember when was the last time I got a thread or warning with AVG. I used to run...
  • How do I retrieve a VB function as an argument in a DLL-function, where the DLL is made in C++?
  • As the title said, I am trying to run a function in the DLL in VB6 with as argument a...

    Tags: Dll


    3 responses so far ↓

    • 1 peepoohead7 // Aug 16, 2008

      just put everything on the same project (separated by .h and .cpp files)

    • 2 Chuck // Aug 16, 2008

      When you’re writing Windows software, the “main thread” is different than other threads that you create. I’m not sure why this is, because on every other operating system, all threads are equivalent.

      So, my advice is to do all calls to dlls and other operating system functions in the main thread, and only use the threads you create for things that are totally internal to your application.

    • 3 balk // Aug 16, 2008

      That depends on the function that you’re calling.
      Your foo(ptr); function is just an example, and you didn’t give the name of the .dll and the function that you’re calling in the .dll.
      Threads have full access to the main thread’s data, and you can call functions from .dlls in threads created by the main thread. If that were not the case, then you wouldn’t be able to call Windows functions from child threads, which wouldn’t make threads very useful.

      You should only use threads in certain situations, and your explanation about ‘external function through a *.h & *.lib’ does not make any sense. I think you should learn more about .dlls and importing functions before messing with threads.

      I recommend this book:
      http://www.microsoft.com/mspress/books/2344.aspx

      Also, trying to program Windows with anything other than the Windows API functions produces incredibly bloated, slow code.
      On top of that, after learning to use idiotic functions provided by frameworks, you still wouldn’t know how to truly program Windows. The Windows API is all that you need.

    Leave a Comment

    *
    To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
    Click to hear an audio file of the anti-spam word

    Tags: Email Spam Uninstall spyware Security Software Trend Micro Registry Cleaner Pc Tools Norton Nod32 Kaspersky Internet Security Hacked Firewall Computer Security Avg Avast Antivirus Ad Aware Monitoring Software Encryption Backup


    A Slow System?
    Harassed by DLL errors?
    Plagued by constant Blue Screens?
    Receiving error messages and don't know why?

     
    • Most popular Software downloads

      • Pctools
      • kaspersky
    About | Contact Us | Old Sitemap Security Software review and download . All rights reserved PoweredBy Yahoo!API.