Call a external executable file. What is the best option?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Call a external executable file. What is the best option?

gerard alis
I need call executable files of OS. I see various options, but I´m not sure. I believe don´t understand correctly.

I need:

     -Call executable files from system.
     -Call associated programs of links, for example, I could pass 'http://google.com'. The result must be open the default browser of user with that link.
     -Call commands or .BATs files from OS.
     -I need use that on any OS, must be cross-platform, is very important.

If that is not implemented on Pharo, is possible create a .exe file with another language, where I call functions of OS, and invoke from Smalltalk that exe?

Regards.


Reply | Threaded
Open this post in threaded view
|

Re: Call a external executable file. What is the best option?

Schwab,Wilhelm K
I think you will find that OS Process work on mac an Linux and NOT on Windows, but ProcessWrapper does work there.  A test on the OS should let you interchange them well enough to get by.

Bill


________________________________________
From: [hidden email] [[hidden email]] On Behalf Of nullPointer [[hidden email]]
Sent: Sunday, February 13, 2011 1:19 PM
To: [hidden email]
Subject: [Pharo-project] Call a external executable file. What is the best      option?

I need call executable files of OS. I see various options, but I´m not sure.
I believe don´t understand correctly.

I need:

     -Call executable files from system.
     -Call associated programs of links, for example, I could pass
'http://google.com'. The result must be open the default browser of user
with that link.
     -Call commands or .BATs files from OS.
     -I need use that on any OS, must be cross-platform, is very important.

If that is not implemented on Pharo, is possible create a .exe file with
another language, where I call functions of OS, and invoke from Smalltalk
that exe?

Regards.



--
View this message in context: http://forum.world.st/Call-a-external-executable-file-What-is-the-best-option-tp3303894p3303894.html
Sent from the Pharo Smalltalk mailing list archive at Nabble.com.


Reply | Threaded
Open this post in threaded view
|

Re: Call a external executable file. What is the best option?

Max Leske
I asked something similar a while back. I've pasted the contents of that discussion below.

Max


--- begin pasted discussion ---

On 13.12.2010, at 09:54, Stéphane Ducasse wrote:

Guys

we should create a nice documentation for the OSProcess please please spend some time on the collabactive book because we need more documentation.

Stef

On Dec 12, 2010, at 6:34 PM, Schwab,Wilhelm K wrote:

OSProcess, which I am learning to like more as I learn more about it, is not well supported on Windows.  Dave recently advised me to use ProcessWrapper on Windows; if he is saying that, then it must be the better path for now.

I have done FFI on both Windows and Linux.  I have not (yet anyway) done any one task in a cross-platform way.  So far, I have not seen anything horrible that would prevent it.  I have zero interest (at least so far) in moving my numerical analysis adventures back toward Windows (they started there and moved to Linux where I am quite happy).  I have a .so interface to Acces IO A/D hardware and a DLL interface to Ascension Technology's 3D tracking software.  Ultimately, I hope to be able to use both of them on either platform (the software exists on both), but have not yet made the connections.

I transparently use OutputDebugString() on Linux and syslog() on Linux, but that does a test on platform and calls completely different code, so it does not count here.

Sorry I can't be of more help.  I urge you to wade into it and ask for help as you get stuck.  For creating libraries, you might want to have a look at Code::Blocks; I don't push it very hard, but I have no complaints.  The "default" is to install MinGW on Windows (last time I looked at least) and it uses gcc on Linux.

Bill


________________________________________
From: [hidden email] [[hidden email]] On Behalf Of Lukas Renggli [[hidden email]]
Sent: Sunday, December 12, 2010 11:43 AM
To: [hidden email]
Subject: Re: [Pharo-project] Is executing a file platform dependent?

With OS Process you can run scripts. That should work identical on Mac
and Unix systems; probably also Windows, but I haven't tried.

With FFI and Alien you can call C libraries. I have not much
experience with those, but normally it should be possible to use them
on all platforms.

Lukas

On 12 December 2010 17:31, Max Leske <[hidden email]> wrote:
Hi guys

I was wondering if it is true that executing a file from within Pharo is platform dependent. I don't actually need to execute a file; it's more a theoretical question and I have no idea what the mechanisms are that would be used. To give you a clearer picture: Imagine you have C, sh, and perl files. What I'm thinking about is that I would have some data in the image that I would want to process with the code in one of those files. I would then wait for the result and process the result in the image.

So my questions are: is there a platform independent way to execute C, sh or perl files from Pharo? Does the VM handle the platform dependencies? Are there any other issues with the idea I described?

Don't go out of your way to find answers, please. But I'd be happy to hear your thoughts.

Cheers,
Max




--
Lukas Renggli
www.lukas-renggli.ch














On 13.02.2011, at 19:20, Schwab,Wilhelm K wrote:

I think you will find that OS Process work on mac an Linux and NOT on Windows, but ProcessWrapper does work there.  A test on the OS should let you interchange them well enough to get by.

Bill


________________________________________
From: [hidden email] [[hidden email]] On Behalf Of nullPointer [[hidden email]]
Sent: Sunday, February 13, 2011 1:19 PM
To: [hidden email]
Subject: [Pharo-project] Call a external executable file. What is the best      option?

I need call executable files of OS. I see various options, but I´m not sure.
I believe don´t understand correctly.

I need:

    -Call executable files from system.
    -Call associated programs of links, for example, I could pass
'http://google.com'. The result must be open the default browser of user
with that link.
    -Call commands or .BATs files from OS.
    -I need use that on any OS, must be cross-platform, is very important.

If that is not implemented on Pharo, is possible create a .exe file with
another language, where I call functions of OS, and invoke from Smalltalk
that exe?

Regards.



--
View this message in context: http://forum.world.st/Call-a-external-executable-file-What-is-the-best-option-tp3303894p3303894.html
Sent from the Pharo Smalltalk mailing list archive at Nabble.com.