Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Managed C++/CLI
  4. Help - unmanaged threads and IJW DLL

Help - unmanaged threads and IJW DLL

Scheduled Pinned Locked Moved Managed C++/CLI
c++helpquestioncsharpdotnet
5 Posts 3 Posters 14 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    Help! I have this problem. I am linking to an unmanaged DLL using IJW (just including the headers). This DLL is thread-safe and calls must run in a thread. I have used the System::Threading classes to create a thread. However, the thread class I have must be integrated into an unmanaged class that inherits from a base class in the dll: e.g. class A : public QQLListener {} where QQLListener is a class in the unmanaged DLL library. However, the thread must be in class A, but you cannot use System::Threading in an unmanaged class and the class CANNOT be managed because it must inherit from an unmanaged abstract base class. What is a solution? Is there a non .NET framework Threading library? My application cannot use MFC, it must be console mode. I need a threading system that works in unmanaged code in console mode in a .NET managed C++ project. Any ideas? Thanks

    R N 2 Replies Last reply
    0
    • L Lost User

      Help! I have this problem. I am linking to an unmanaged DLL using IJW (just including the headers). This DLL is thread-safe and calls must run in a thread. I have used the System::Threading classes to create a thread. However, the thread class I have must be integrated into an unmanaged class that inherits from a base class in the dll: e.g. class A : public QQLListener {} where QQLListener is a class in the unmanaged DLL library. However, the thread must be in class A, but you cannot use System::Threading in an unmanaged class and the class CANNOT be managed because it must inherit from an unmanaged abstract base class. What is a solution? Is there a non .NET framework Threading library? My application cannot use MFC, it must be console mode. I need a threading system that works in unmanaged code in console mode in a .NET managed C++ project. Any ideas? Thanks

      R Offline
      R Offline
      Rama Krishna Vavilala
      wrote on last edited by
      #2

      You cannot derive managed class from an unmanaged class. You should do something like this __gc class A { QQLListener* pSl; public: A() { pSl = new QQLListener(); } void ThreadStart() { pSl->threadStart(); } }

      L 1 Reply Last reply
      0
      • L Lost User

        Help! I have this problem. I am linking to an unmanaged DLL using IJW (just including the headers). This DLL is thread-safe and calls must run in a thread. I have used the System::Threading classes to create a thread. However, the thread class I have must be integrated into an unmanaged class that inherits from a base class in the dll: e.g. class A : public QQLListener {} where QQLListener is a class in the unmanaged DLL library. However, the thread must be in class A, but you cannot use System::Threading in an unmanaged class and the class CANNOT be managed because it must inherit from an unmanaged abstract base class. What is a solution? Is there a non .NET framework Threading library? My application cannot use MFC, it must be console mode. I need a threading system that works in unmanaged code in console mode in a .NET managed C++ project. Any ideas? Thanks

        N Offline
        N Offline
        Nish Nishant
        wrote on last edited by
        #3

        Anonymous wrote: Is there a non .NET framework Threading library? My application cannot use MFC You can use the API. CreateThread(). Or CRT. _beginthreadex() Nish


        Regards, Nish Native CPian. Born and brought up on CP. With the CP blood in him.

        1 Reply Last reply
        0
        • L Lost User

          Thanks for the advice, but unfortunately this will not work either. QQLListener is the base class of a subject-observer design pattern, it must be inherited by a derived class so that the callback methods inside it are called. I suppose there is no way to use my old C++ library with the .net framework. I think it's not quite as "compatible" as they claim.

          R Offline
          R Offline
          Rama Krishna Vavilala
          wrote on last edited by
          #4

          Anonymous wrote: . I think it's not quite as "compatible" as they claim. The stuff is compatible the exact way of doing things depends on a case to case basis. If you provide little more details then probably I could help.

          1 Reply Last reply
          0
          • R Rama Krishna Vavilala

            You cannot derive managed class from an unmanaged class. You should do something like this __gc class A { QQLListener* pSl; public: A() { pSl = new QQLListener(); } void ThreadStart() { pSl->threadStart(); } }

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #5

            Thanks for the advice, but unfortunately this will not work either. QQLListener is the base class of a subject-observer design pattern, it must be inherited by a derived class so that the callback methods inside it are called. I suppose there is no way to use my old C++ library with the .net framework. I think it's not quite as "compatible" as they claim.

            R 1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups