Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 [O'Caml]Why can't you name your compiled exe "program.exe"
Index -> Programming, General Programming -> Functional Programming
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
richcash




PostPosted: Mon Oct 15, 2007 8:21 pm   Post subject: [O'Caml]Why can't you name your compiled exe "program.exe"

The O'Caml toplevel interpreter doesn't work if you compile your O'Caml code and name it "program.exe" or "Program.exe". If you do this and try to open the objective caml interpreter, it will just open your "program.exe" and run it. At least this is the case if your "program.exe" is located in C:/ on Windows.

I find this very odd and wondered if anyone had an explanation for it. I thought maybe it was because the toplevel interpreter uses a file called program.exe, but I doubt this is the case because if this file exists it would have a different directory.

Does anyone know why this happens? Thanks.
Sponsor
Sponsor
Sponsor
sponsor
PaulButler




PostPosted: Mon Oct 15, 2007 9:05 pm   Post subject: RE:[O\'Caml]Why can\'t you name your compiled exe "program.exe"

Cool, an ocaml question.

I am on linux so I can't try this, but it sounds odd. I don't quite understand what the problem is though. Are you using the bytecode interpreter, or compiling to native code?
richcash




PostPosted: Mon Oct 15, 2007 9:19 pm   Post subject: Re: [O'Caml]Why can't you name your compiled exe "program.exe"

I am compiling to native code first. I am just compiling some source file and naming the executable "program.exe". I then keep this exe on my computer.

Then, I open the objective caml interpreter (you know, the thing that's like irb) to just test something out or do some other programming, and it doesn't work. It runs my "program.exe".

You could try it on linux, it might be the same? Compile a program to bytecode and call the exe "program.exe" and see if you can run the interpreter.
Tony




PostPosted: Mon Oct 15, 2007 9:22 pm   Post subject: RE:[O\'Caml]Why can\'t you name your compiled exe "program.exe"

even if the file has a different directory, it can still be found if the said directory is in the PATH.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Tony




PostPosted: Mon Oct 15, 2007 9:24 pm   Post subject: Re: [O'Caml]Why can't you name your compiled exe "program.exe"

richcash @ Mon Oct 15, 2007 9:19 pm wrote:
You could try it on linux, it might be the same? Compile a program to bytecode and call the exe "program.exe" and see if you can run the interpreter.

There are no .exe type of executables on *nix systems.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
richcash




PostPosted: Mon Oct 15, 2007 9:34 pm   Post subject: Re: [O'Caml]Why can't you name your compiled exe "program.exe"

Tony wrote:
There are no .exe type of executables on *nix systems.

Oh, I didn't know this. Never mind then.

Tony wrote:
even if the file has a different directory, it can still be found if the said directory is in the PATH.

But if this executable that the interpreter uses is "C:/Program Files/Objective Caml/.../program.exe" it shouldn't be affected by "C:/program.exe" should it?


EDIT:
After quickly searching, I couldn't find anything named program.exe in "program files/objective caml".
Tony




PostPosted: Mon Oct 15, 2007 10:28 pm   Post subject: RE:[O\'Caml]Why can\'t you name your compiled exe "program.exe"

Well the problem is that the "wrong" program.exe is found first. You might want to call the interpreter in a more specific way, to avoid ambiguity.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
richcash




PostPosted: Mon Oct 15, 2007 10:37 pm   Post subject: Re: [O'Caml]Why can't you name your compiled exe "program.exe"

Tony wrote:
Well the problem is that the "wrong" program.exe is found first.

Oh, so that is possible. That must be the problem here.

Tony wrote:
You might want to call the interpreter in a more specific way, to avoid ambiguity.

Unfortunately, I don't think there is any way to do this. You just open the interpreter (which is not named program.exe) by clicking on it and it supposedly it uses program.exe in the background.

It's not a big deal, you just can't name your program "program.exe". Thank you Tony and PaulButler for the replies.
Sponsor
Sponsor
Sponsor
sponsor
rdrake




PostPosted: Tue Oct 23, 2007 8:12 pm   Post subject: Re: [O'Caml]Why can't you name your compiled exe "program.exe"

So anyways, I'm sitting there, compiling some code for wtd's challenge. I name my file Program.cs and compile it to Program.exe in the C:\ directory. I notice shortly after that a DOS window keeps opening up. What was there you might ask? Well, it was my program running over and over again every so often.

Upon a reboot I discovered the attached message. After removing both offending files the strange message and random windows popping up stopped.

And the mystery lives on...



warning.png
 Description:
 Filesize:  11.88 KB
 Viewed:  447 Time(s)

warning.png


Tony




PostPosted: Tue Oct 23, 2007 8:25 pm   Post subject: RE:[O\'Caml]Why can\'t you name your compiled exe "program.exe"

Here's an idea - don't save random stuff to the root directory. I suppose on Windows, C:\ is as close to the root as you're going to get. This is what your desktop is for Wink
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Display posts from previous:   
   Index -> Programming, General Programming -> Functional Programming
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 10 Posts ]
Jump to:   


Style:  
Search: