CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 11 of 11

Thread: delay in dll

  1. #1
    Join Date
    May 2015
    Posts
    500

    delay in dll

    Hi ,

    The client code calls my dll and my dll writes into their o/p.

    But the issue is , if there is long time, for my dll to do some processing, how to make sure the client looks into o/p after this processing is over. Because the o/p array might be half written

    I was told that, the client waits for the function to end. But others arguing that, the array might be half baked !

    thanks a lot for your inputs !

    Pdk

  2. #2
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,822

    Re: delay in dll

    The client code calls a function that is located within the .dll.

    What is o/P?
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++23 Compiler: Microsoft VS2022 (17.6.5)

  3. #3
    Join Date
    May 2015
    Posts
    500

    Re: delay in dll

    output is pointer to memory location allocated by the client

  4. #4
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,822

    Re: delay in dll

    Well if the called function writes to this memory, then presumably unless the function is threaded and returns whilst a background thread completes (asynchronous transfer), then when the function terminates and returns to the caller then all the writing required to the memory has been completed? Is the function single or multi-threaded? Is the transfer synchronous or asynchronous?
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++23 Compiler: Microsoft VS2022 (17.6.5)

  5. #5
    Join Date
    May 2015
    Posts
    500

    Re: delay in dll

    I think it is single threaded

  6. #6
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,822

    Re: delay in dll

    Quote Originally Posted by pdk5 View Post
    I think it is single threaded
    It either is or is not. In programming you determine what is happening - you don't guess.

    So why might the o/p be only half written when control is passed back to the caller?
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++23 Compiler: Microsoft VS2022 (17.6.5)

  7. #7
    Join Date
    May 2015
    Posts
    500

    Re: delay in dll

    because it is taking long to complete as it is just a function call and there is no way of knowing if o/p is written or not

  8. #8
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: delay in dll

    Quote Originally Posted by pdk5 View Post
    because it is taking long to complete as it is just a function call and there is no way of knowing if o/p is written or not
    It doesn't matter how long it takes to complete. Only the fact whether this "function" may or may not return before the writing has completed matters.
    Victor Nijegorodov

  9. #9
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,822

    Re: delay in dll

    and whether it has completed successfully or not.
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++23 Compiler: Microsoft VS2022 (17.6.5)

  10. #10
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: delay in dll

    Quote Originally Posted by 2kaud View Post
    and whether it has completed successfully or not.
    Agree!
    Victor Nijegorodov

  11. #11
    Join Date
    May 2015
    Posts
    500

    Re: delay in dll

    Yes, my collegue came from multithreaded background and was confused about this.

    Eventhough i havent worked on multithreading much, but i knew, in case of single thread this wont be issue. But couldnot argue further because of my limited computer programming knowledge.

    But anyway thanks a lot kaud and victor. It is much appreciated.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured