visual c++ - Creating a new "internal" process? -


i'm writing dll (in visual c++) , decided need move stuff happens in threads own process. because want support multiple instances of dll being loaded , running. however, need access same group of resources (i/o buffers com port) needs autonomously monitored long there @ least 1 instance of dll running.

it seems need use createprocess(), i'm unclear on how should use lpapplicationname argument. in examples i've seen, name of existing program gets passed, isn't imagine need do. expected able start process specifying function, createthread(). process doesn't need compiled , output own executable, it? shouldn't used other dll. thanks.

edit: okay, if createprocess() can start pre-existing program, how can work? if following happens:

  1. process loads dll
  2. dll starts port monitoring threads
  3. second process loads dll
  4. second dll establishes ipc access same data first dll
  5. first dll exit, , terminates monitoring threads
  6. second dll starts own monitoring threads , continues

doing 5 , 6 seems (especially implementation) clunky way of doing things, rather have behavior never have terminate , restart.

edit: more think this, more idea of making separate executable, if think of more "elegant" method, i'd still know.

you can't that. on *nix fork can call whatever function want, createprocess doesn't work way. thing createprocess can launch new process execution starting @ entry point of on-disk executable.


Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -