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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. Program Structure

Program Structure

Scheduled Pinned Locked Moved C#
questioncsharphelpworkspace
4 Posts 3 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.
  • K Offline
    K Offline
    Kash
    wrote on last edited by
    #1

    I am calling a dll from C#. The dll is called from a single function call in C# (dllimport ...) The dll produces data, which I want to access in real-time as and when it is generated in C#. However, the single function call will obviously only return the final answer. How can I setup either the dll or the C# to give me data as I require? Do I need to make an additional function call in C# that gives me access to the data or will the dll have to setup to send data back periodically? If so, how can I do this? Your help is appreciated. -- modified at 12:30 Tuesday 6th September, 2005

    J L 2 Replies Last reply
    0
    • K Kash

      I am calling a dll from C#. The dll is called from a single function call in C# (dllimport ...) The dll produces data, which I want to access in real-time as and when it is generated in C#. However, the single function call will obviously only return the final answer. How can I setup either the dll or the C# to give me data as I require? Do I need to make an additional function call in C# that gives me access to the data or will the dll have to setup to send data back periodically? If so, how can I do this? Your help is appreciated. -- modified at 12:30 Tuesday 6th September, 2005

      J Offline
      J Offline
      Judah Gabriel Himango
      wrote on last edited by
      #2

      Let me ask if I'm understanding your problem correctly. Your C/C++ dll produces data in real-time, but only gives the final result back, yet you want your C# code to have access to the real-time data? If that's what you want, then you have a few options. One option is to split up the C/C++ function into several functions, each returing parts of the real-time data. Another option is to pass a delegate type to the C/C++ dll which will be called from inside the C/C++ dll as it receives real-time data. I'd recommend the latter option.

      Tech, life, family, faith: Give me a visit. I'm currently blogging about: Cops & Robbers Judah Himango

      K 1 Reply Last reply
      0
      • J Judah Gabriel Himango

        Let me ask if I'm understanding your problem correctly. Your C/C++ dll produces data in real-time, but only gives the final result back, yet you want your C# code to have access to the real-time data? If that's what you want, then you have a few options. One option is to split up the C/C++ function into several functions, each returing parts of the real-time data. Another option is to pass a delegate type to the C/C++ dll which will be called from inside the C/C++ dll as it receives real-time data. I'd recommend the latter option.

        Tech, life, family, faith: Give me a visit. I'm currently blogging about: Cops & Robbers Judah Himango

        K Offline
        K Offline
        Kash
        wrote on last edited by
        #3

        Hi, Yes that's what I'm trying to do. The dll is written in Fortran so splitting up the routines is definitely not something I want to do. I was half-expecting the answer to be on multithreading whereby a call would be made to the main process and periodically a call would be made to the fortran routine that keeps the data with a flag so tell C# that new data has arrived. Just for interest, would this be a good idea? However, I will try as you suggest.

        1 Reply Last reply
        0
        • K Kash

          I am calling a dll from C#. The dll is called from a single function call in C# (dllimport ...) The dll produces data, which I want to access in real-time as and when it is generated in C#. However, the single function call will obviously only return the final answer. How can I setup either the dll or the C# to give me data as I require? Do I need to make an additional function call in C# that gives me access to the data or will the dll have to setup to send data back periodically? If so, how can I do this? Your help is appreciated. -- modified at 12:30 Tuesday 6th September, 2005

          L Offline
          L Offline
          leppie
          wrote on last edited by
          #4

          pass a reference to a struct into the dll (if u have access to that) function that u can inspect on the client side, then fire off the dll function in a seperate thread. xacc-ide 0.0.15 now with C#, MSIL, C, XML, ASP.NET, Nemerle, MyXaml and HLSL coloring - Screenshots

          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