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. C / C++ / MFC
  4. What's that? I can't add more variables in a class - then the whole program doesn't work!

What's that? I can't add more variables in a class - then the whole program doesn't work!

Scheduled Pinned Locked Moved C / C++ / MFC
helpsysadminperformancequestiondiscussion
3 Posts 2 Posters 0 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.
  • B Offline
    B Offline
    bond006
    wrote on last edited by
    #1

    Hello, I've created a program which is waiting for incoming network connections via I/O Completion Ports and I've created a pointer in the network class to a packet processing class which's object is created outside of the class on the heap memory. All the things worked fine, but I got an error. No compiler or linker error - no error at all, but GetQueuedCompletionStatus() doesn't receive completed packets, when I add a specific number of bytes (in variables) in the Packet Processing Class. What's this??? Memory problems? Other problems? The Processing Class do nothing - an object of it is just created - that's all and the Packet Processing class has no relation to the Thread Function which is call the GetQueuedCompletionStatus() function. I can only add a WSABUF variable plus 3 bools and 1 short. That's all. What do you think is the error? Thanks for your attention and your help, bond006

    H 1 Reply Last reply
    0
    • B bond006

      Hello, I've created a program which is waiting for incoming network connections via I/O Completion Ports and I've created a pointer in the network class to a packet processing class which's object is created outside of the class on the heap memory. All the things worked fine, but I got an error. No compiler or linker error - no error at all, but GetQueuedCompletionStatus() doesn't receive completed packets, when I add a specific number of bytes (in variables) in the Packet Processing Class. What's this??? Memory problems? Other problems? The Processing Class do nothing - an object of it is just created - that's all and the Packet Processing class has no relation to the Thread Function which is call the GetQueuedCompletionStatus() function. I can only add a WSABUF variable plus 3 bools and 1 short. That's all. What do you think is the error? Thanks for your attention and your help, bond006

      H Offline
      H Offline
      Harsha Gopal
      wrote on last edited by
      #2

      Hi, I had some problem like this when I used new operator to create an object of a class (a class containing objects of other classes). So, I could get around it by using malloc.... Although, it may sound unprofessional, you may want to give it a try.... Also, if your recently added variable is a static instance of another class which needs dynamic memory allocation, it would be wiser to use a pointer instance of the new class... Pl. share if it solves the problem. Harsha ---------------------------------- http://www.ece.arizona.edu/~hpg ----------------------------------

      B 1 Reply Last reply
      0
      • H Harsha Gopal

        Hi, I had some problem like this when I used new operator to create an object of a class (a class containing objects of other classes). So, I could get around it by using malloc.... Although, it may sound unprofessional, you may want to give it a try.... Also, if your recently added variable is a static instance of another class which needs dynamic memory allocation, it would be wiser to use a pointer instance of the new class... Pl. share if it solves the problem. Harsha ---------------------------------- http://www.ece.arizona.edu/~hpg ----------------------------------

        B Offline
        B Offline
        bond006
        wrote on last edited by
        #3

        I don't know how I solved the problem. I didn't use malloc and I had no static variables in the class. It was a quite weird problem.

        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