how does IDEs communicate with compilers to get error messages? - compilation

i am working on a programming language project , i am coding the compiler in C++/C and and the IDE in python (tkinter) , for the communication between them i used temp files , now i am integrating native support to my language , and i want my IDE to communicate with mingw and to compile c/c++ code , but i don't know how does mingw expect me to pass arguments , i want it to compile c/c++ files without appingring a console window , and i want it to send me back the output like my compiler does , i dont know if mingw uses files or sockets to talk with IDEs . then how can i let my IDE askes mingw to compile native code and receives the output without the appearance of a console window ? or how does IDEs ( like code::blocks , eclipse ....) communicate with the compiler ? i tried to use make files but , always there is a console window and i can't receive errors . :/

i found t , the solution is the use of inter-process-communication like here https://msdn.microsoft.com/en-us/library/windows/desktop/ms687393(v=vs.85).aspx and this helps alot How to redirect the output of gcc compiler to a file? after executing the compilers you need to read the stderr stream to get the output , i am answering my own question to help others

Related

MinGW make file compiles but codeblocks will not build

I am trying to convert a C program to VB.NET. (I know, just accept I have my reasons and leave it at that).
Anyway, I wasn't sure if the source code I had was any good so after about a week of pulling my hair out I finally downloaded CodeBlocks, grabbed the MinGW directory and I can make working successful build from a command line using Mingw32-make. Now I want to use codeblocks to build the file because ultimately I want to be able to step through the code however when I try I just get a bunch of errors and no exe. I am not sure what I am doing wrong and just need help. For that matter is there anyway to just have MinGW create some kind of debug info that would be usefull in Visual Studio? I am not a C programmer so sorry if it seems obvious.

mingw32 posix threading library

I have installed MinGW on my windows7 machine, using instructions from here. Basically I used the GUI installer assistant called mingw-get-setup.exe. The installation manager allowed me to select a package called mingw32-libpthreadgc which installs bin/pthreadGC2.dll and bin/pthreadGCE2.dll.
To my knowledge that is not sufficient to compile code depending on the pthread library. E.g. trying to compile a file with a header-include like #include "pthread.h" - to no surprise - results in a "file not found" compile error. I can't find that header in my MinGW directory. If I use includes/headers from elsewhere, I'm afraid they might not match with the DLL's interface. How is this meant to be working?
(Furthermore I like to use CodeBlocks as the IDE. How would I set up a simple "HelloWorld"-like pthread program to get it all to work? There seems to be a lot of conflicting messages out there on how to set it up. Use "-pthread" vs "-lpthread". Set it in compiler and linker settings, right? Copy-paste the DLL's? What else???)
I had similar problem, https://www.sourceware.org/pthreads-win32/ this did job for me,
I used this in combination with mingw32. It also has nice README file.

How does an ide compile code?

Thinking about NetBeans or Eclipse I was wondering how an IDE compiles code when you click run. Does it open a command line in the background to compile it? How exactly does it work?
Each IDE will have it's own approach for how they actually achieve compilation. Usually they will have their own compilers or wrappers around existing compilers to which they delegate actual compilation.
Eclipse comes with a built in compiler of its own:
How does Eclipse compile classes with only a JRE?
I don't actually personally know much about how other ones achieve the compilation in any detail; somebody else may provide a better answer in that regard.
IDEs use compilers. That's actually the difference between them.
For instance, Code::Blocks uses MinGW Compiler which is a port of the GCC set of compilers.
Every compiler has its own method, some use their own wrappers and ports for known compilers. (See Codeblocks)
I also noticed that some basic IDEs out there, just run the simple command line using gcc, clang, etc and let you pass parameters from an option window.

How to run GhostScript on AS400 server

We have PDF files on the AS/400 and we need to convert them to PCL for printing . So for this we found Ghostscript for converting PDF file to PCL format , so we're looking for a way to run Ghostscript commands on the AS/400.
Have you please any idea how to do it , if no I am looking for another "free" method to do what we need.
Any help will be appreciated
Ghostscript doesn't accept PCL as input, you need Ghostpdl for that, and more specifically the pcl6 executable.
You can't 'run Ghostscript commands' you can run the executable with the PCL file as an input and suitable command line switches.
In order to do this you will need to compile Ghostscript for your target environment (AS/400 apparently). Ghostscript is written in standard C so you will need a C compiler, the build process is convoluted and requires running a number of executables in order to generate some platform specific files.
Your first task is going to be porting Ghostscript and its build process onto your target platform. I'm not aware of anyone having done this for AS/400 but we'd be interested to hear how you get on.

Using nmake on OSX?

I'm porting an application to MacOS X - but the original developer's build system uses NMAKE, and ideally they'd like to keep it instead of switching to a new one.
I've managed to get NMAKE running under OSX using wine (built using MacPorts) and added Objective C support to the build files, and created a Unix-linked PE wrapper 'run.exe' which wine can load but uses POSIX to call back into things like gcc and ld, as is described on various places online as a means of escaping out of wine back into Unix.
However, I'm having a few specific issues. They're minor enough that I can get on with the port, but it does mean I need to run builds a few times sometimes, because of timing.
Basically, when wine.exe calls back into the shell and thus gcc, the link between child processes seems to be broken. gcc and ld will never return an error code even on failure, because they can't get the exit code from their spawned children. ar will actually print out it can't find its child and return immediately, causing problems when ld tries to link object files to libraries that are still being put together.
Has anyone else tried anything similar and seen the same problem, on OSX or elsewhere? Is there an obvious solution?
The Microsoft .NET Rotor (SSCLI) project includes source code, intended to be build on OSX and elsewhere. The Rotor source code includes the source code to NMake. So get Rotor working, then use it's Nmake. Even if you prefer to continue to use your Wine-based Nmake, you could probably learn from Rotor's use of Nmake on Unix, it's use of Gcc, etc.
If there is nothing that odd / inconsistent about the original developers build system, could you write an automatic conversion of their make files back into Unix make, and keep your builds 'native'?
(Builds being fraught enough anyway, without extra complications)

Resources