Rob Shearman wrote:
Sergio Tridente wrote:
Sergio wrote:
Hi,
From a win32 program compiled with winelib I am trying to execute the
following: FILE *program; if (program = popen("dcop amarok player nowPlaying", "r")) fgets(buff, sizeof(buff), program); The idea is to read the current track amarok's playing. But I keep receiving the following text: "File not found". Later I tried changing to : popen("ls", "r"), and the same problem arised. Finally I changed to popen("dir", "r") and then I got some data read (first line of the dir command). So, what I understand is that the popen function is opening/reading only windows programs. How can I make it open a pipe on a Linux' one? Is there something like linux_popen()?
Thanks. Sergio.
OK. It's me, the same person of the original post (I just changed my e-mail adress).
I just imagined that what I needed to do could be achieved by creating a separate source file which will be compiled using gcc against the standard linux's libraries. Then I compiled the rest of the program and linked everything together. Now, when I tried to run the application to just do: program = popen("ls .", "r") I got a message in the console saying "err: broken pipe". To make the binary I did:
- gcc -c linuxsource.c -o linuxsource.o
- wingcc -c restofprogram.c -o restofprogram.o
- To link: wingcc -share binaryname.spec restofprogram.o linuxsource.o
resource.res -L/usr/local/lib/wine -lwine -lmsvcrt -lgdi32 -lshell32
Here is the problem ^ you are linking with msvcrt so you are getting the msvcrt version of popen.
-lole32 -lcomctl32 -lcomdlg32 -o binaryname.dll And well, I am actually making a dll not a program.
Rob
I see. But I need to link to msvcrt for the rest of the functions in the dll I am trying to make. I only need popen to be linked using linux' libraries. Do you know what I can do to have both things (standard popen and wine's libraries for the rest of the dll)?
Thanks.