My question is about mixing multiple programs. For example if you use Unreal Development Kit before you know what I'm talking about. The Lightmass of Unreal is another program which have another exe from the main application (editor). When you build the lighting, lightmass program will run in the background. How it is working? Has the main program give a memory location to Lightmass? or are they communucating via windows messages/sockets.or something.
Btw. Maybe a related maybe not I don't sure, What is the argument parameters of C/C++ main function. What is its purpose exactly and where it can be used?
Thanks.
I did some search and now I know that I meant IPC (Inter Process Communucation)
Related
Similar to the linux execve(3) syscall, I want to replace the current process with a new one in Rust, in a way that works on both Unix and Windows systems. I'm fine with using crates if necessary, although I would like to stay away from unsafe.
So far, the only thing I've found in the standard library is std::os::unix::process::CommandExt::exec, but this only works on Unix. Looking for crates, I found the exec crate, but it doesn't appear to support Windows. However, this open PR mentions that it's possible to use the wexecvp syscall on Windows to achieve the same functionality, although it doesn't work on the Windows Runtime and only works on Win32. (That's good enough for me, though.) I'm at a dead-end on how to do this without breaking out libc::wexecvp and unsafe.
Is there a way to replace the current process with a new one in a cross-platform way in Rust?
This is a question that is independent of the programming language used, because it's about the process models of operating systems.
The answer is simply No.
The Windows process model doesn't work this way -- it's not a *nix.
Some things are fundamentally nonportable. So, you'll need to figure out what your functional requirement is (e.g. stdio handle inheritance, permissions, environment, etc.), and how to implement that on the other platform(s).
I can't get more specific because you'd need to provide more details on what "replace the current process by another one" means for your app You can always launch another program and quit, which naively sounds like the same thing :-).
I'm looking for a way for one program to send a string to another program (both in TCL). I've been looking into "threading", however I haven't been able to understand how it works and how to do what I want with it.
I would suggest you look at the comm package in tcllib. This package provides remote script execution between Tcl interpreters using sockets as the communications mechanism. Since both sides are in Tcl, this is an easy way to go.
im going crazy trying to look for examples of unix domain socket usage on bash. I'm starting to think if it is possible at all, and thenI find people using them for netowrk stuff, i wanting merely for IPC locally, can someone facilitate me some example, resources, guidance or at least if its possible at all?
Is this so deep in the kernel that it can only be programmed C for example... I;ve seen some Python stuff i think tho...
Thanks.
I've decided to go off using bash, it would be a big big task and i dont have any real constrains, I have learn a lot of how linux works tho, in essence to be able to implement this would have to probaly modify some parts of the kernel...
Thanks everyone.
I'd like to write a x11 terminal emulator, but I don't know how I should spawn and communicate with the shell, is there any basic (pseudo- or C) code for that? like what sort of PTY to create, how to bind the shell to it, what signals I have to catch or send, etc. don't really feel like sorting through the whole xterm sources.
EDIT: oh and I want to implement a way of communicating with any applications in it, how shall I do the feature discovery? some hidden ansi sequence in the "clients", hoping it's not colliding with other terminal emulators? some environment variable, hoping it's not colliding with the "clients" or removed by the shell?
YAT (yet another terminal) https://github.com/jorgen/yat is suitable for embedding in Qt Quick programs. Contributions for improvement are welcome. (Disclaimer: a friend started that project, and I work on it sometimes.) It takes a mostly correct approach (e.g. it uses a Linux pseudo-terminal properly, something I didn't know about before my friend was explaining that), and has a lot of features; however the parser is written from scratch and is not feature-complete or bug-free yet.
Unfortunately most terminal implementations so far have been starting from scratch, or with a one-off monolithic fork (from rxvt for example), which is a lot of work and results in all of them being incomplete. So I think a better alternative would be to use a reusable logic-only library called libvterm: http://www.leonerd.org.uk/code/libvterm/ or to base your terminal on one which already uses that. That way if you find bugs and fix them, you'll improve the whole ecosystem.
https://github.com/timmoorhouse/imgui-terminal is interesting, and works (at least somewhat) but is a prime candidate to be rewritten with libvterm, IMO. If you are into immediate-mode rendering in OpenGL, it might be a good choice anyway.
http://41j.com/hterm/ does use libvterm, and adds a few features which libvterm doesn't have, for inline graphics rendering (ReGIS and PNG). But the code is not elegant enough or portable enough, IMO, and the graphics rendering "floats" over the text rather than being truly inline. It still might be an adequate starting point for some use cases. In my fork https://github.com/ec1oud/hackterm I got it to build with mostly modern system libraries, however it still depends on an outdated version of SDL, which is included.
OK, if anyone also need this, and is using lua, I found the http://www.tset.de/lpty library works fine. still testing ansi escapes and stuff, but should work.
I am a normal user and does not have strong background in programming.
I have a 64 bit, dual core machine (Dell Vostro 3400) and I think I can run multithreaded program with this machine (yes?)
The program that I think could be convert into multithreaded program is this:
http://code.google.com/p/malwarecookbook/source/browse/trunk/3/8/pescanner.py
Is possible to do so?
If yes, which part should being edited so that it will work?
Thanks.
Multithreading is not an easy subject.
I suggest you read up on some tutorials, see:
http://www.tutorialspoint.com/python/python_multithreading.htm
http://www.devshed.com/c/a/Python/Basic-Threading-in-Python/
http://www.artfulcode.net/articles/multi-threading-python/
To answer the general part of your question, you can run multithreaded code an any machine newer than say 2000.
Your question is too broad though to answer without going into details on the code.
My suggestion
I suggest you try the tutorials first and write same sample programs, ask a specific question with sourcecode! if you get stuck.
That's a road I'd recommend rather than taking someone else's code and rewriting it without detailed knowledge of threads.