Skip to main content
gamedev.net
🔒 Locked

Compiler

Started by ao 12 replies 450+ views
Original Post
ao
ao
I''m working on some cgi stuff, but do not have access to a telnet account or I would just ftp my .c file up to the server and compile it with gcc... I''m looking for a compiler that will compile out to a unix executable binary on a windows machine. Does anyone know if there is a compiler available that will do that? ao
gmcbay
gmcbay
In short, yes.

But it may be a huge pain to get the compiler configured.

gcc supports cross-compilation, allowing you to compile binaries for one OS/Processor on another. You could set up a gcc enviornment on your Windows system that generated binaries for the other machine...

It''s been so long since I''ve used gcc that I couldn''t give you easy to digest instructions on how to set this up, but it can be done...

Also, you''ll need to know more about the UNIX platform you are using. Not all UNIXes are created equal...At a minimum you need to know the processor family it runs on (x86, SPARC, Alpha, MIPS, etc...) and the actual UNIX variant (Linux, Solaris, IRIX, etc.).

TUna
TUna
If you have an old 486 lying around there it would probably be easiest just to install Linux on that and use it for dev/testing
Muzzafarath
Muzzafarath
Convert your script to Perl. I know it doesn''t answer your question, but CGI scripts were MEANT to be written in Perl, not C!
I'm reminded of the day my daughter came in, looked over my shoulder at some Perl 4 code, and said, "What is that, swearing?" - Larry Wall
Cyberdrek
Cyberdrek
Muzzafarath: as far as I know, there are no set languages for
CGI scripting.


Cyberdrek
Headhunter Soft
DLC Multimedia
[Cyberdrek | ]
Muzzafarath
Muzzafarath
quote:

Muzzafarath: as far as I know, there are no set languages for CGI scripting.



I know that, I was just saying that it's much better to write CGI scripts in Perl. Who wants to worry about buffer overflows when writing CGI scripts anyway? Perl was designed to handle text in an efficient manner (I believe Perl stands for "Practical Extraction and Report Language"), C was _not_ designed to handle large masses of text, and basically everything you do in CGI scripts is lots of text, and Perl is really good at this.

Edited by - Muzzafarath on October 30, 2000 11:26:13 AM
I'm reminded of the day my daughter came in, looked over my shoulder at some Perl 4 code, and said, "What is that, swearing?" - Larry Wall
bishop_pass
bishop_pass
quote:
Original post by Muzzafarath

Convert your script to Perl. I know it doesn't answer your question, but CGI scripts were MEANT to be written in Perl, not C!


I have written CGI scripts in C. The key is to find a host that will give you a shell account. If some serious computations are going to be done each time a CGI is called, then I would definitely opt for C.

If you are not going to do serious number crunching in your CGI, then a better alternative to both C and Perl is PHP. It is free, and has built in support for connecting to a MySQL server, on the fly image generation, and the code is placed within the HTML page and processed on the server before sent out to the client.

So, I suggest you find a server that offers PHP and MySQL and a shell account for that matter. Cost just isn't an issue anymore. I'm sure you can find a host that will give you these features for less than $10 a month.

More info on PHP: www.php.net

Also, PHP is compiled right into the Apache server, so little overhead is incurred when a PHP script is processed. In addition, PHP offers full 'regular expression' support for text processing.



Edited by - bishop_pass on October 30, 2000 11:56:02 AM

Edited by - bishop_pass on October 30, 2000 11:56:36 AM
_______________________________
"To understand the horse you'll find that you're going to be working on yourself. The horse will give you the answers and he will question you to see if you are sure or not."
- Ray Hunt, in
Staffan
Staffan
I''m not sure about this but don''t you have to chmod the cgi script and allow it to be executed? Anyways, I know you usually can not just put it in your personal directory on the server...

"Paranoia is the belief in a hidden order behind the visible." - Anonymous
bishop_pass
bishop_pass
quote:
Original post by Staffan

I''m not sure about this but don''t you have to chmod the cgi script and allow it to be executed? Anyways, I know you usually can not just put it in your personal directory on the server...


That is true, it must be executable and in the cgi-bin.

_______________________________
"To understand the horse you'll find that you're going to be working on yourself. The horse will give you the answers and he will question you to see if you are sure or not."
- Ray Hunt, in
ao
ao
Ok, thanks for the help guys. I''ll dig a little deeper into gcc. I was thinking about looking at perl as well, but I really want to do it in c since I have done all my previous scripts in c.

I do have an old pc lying around that I could setup linux on, hmmm....

Well if anyone has any other idears be sure to post em.

ao
bishop_pass
bishop_pass
quote:
Original post by ao

Ok, thanks for the help guys. I''ll dig a little deeper into gcc. I was thinking about looking at perl as well, but I really want to do it in c since I have done all my previous scripts in c.



So you insist on not heeding my advice on PHP then? I have 13 years experience programming in C and I am generally not fond of learning new languages just for fun, but I will tell you, PHP is easy, it is like C, and it helps by shifting your attention from the nuances of programming CGI to the more productive task of designing dynamic web pages. Plus, the interface to MySQL makes the creation and maintenance of data easy.



_______________________________
"To understand the horse you'll find that you're going to be working on yourself. The horse will give you the answers and he will question you to see if you are sure or not."
- Ray Hunt, in
ao
ao
Actually I have used php before and yes it is easy. Although I''m not an expert with it, I cant be sure that the server I put my stuff on will have php setup on it. Also I don''t know if php can do what I need.

Can php open a connection to another server somewhere else to send data to? Heck, I don''t even know if cgi will allow me to do that, but I''m gonna try.

ao
bishop_pass
bishop_pass
quote:
Original post by ao

Can php open a connection to another server somewhere else to send data to? Heck, I don''t even know if cgi will allow me to do that, but I''m gonna try.


Sounds like a job employing sockets. C and Java come to mind for that. I don''t know if PHP can let you do that, but it does have a growing set of functionality.



_______________________________
"To understand the horse you'll find that you're going to be working on yourself. The horse will give you the answers and he will question you to see if you are sure or not."
- Ray Hunt, in
Muzzafarath
Muzzafarath
quote:
Original post by ao

Actually I have used php before and yes it is easy. Although I''m not an expert with it, I cant be sure that the server I put my stuff on will have php setup on it. Also I don''t know if php can do what I need.

Can php open a connection to another server somewhere else to send data to? Heck, I don''t even know if cgi will allow me to do that, but I''m gonna try.

ao


PHP will let you open a socket connection to another server (although it''s not certain that the _sysadmins_ allow that ). http://se.php.net/manual/ref.sockets.php. Perl can also do that
I'm reminded of the day my daughter came in, looked over my shoulder at some Perl 4 code, and said, "What is that, swearing?" - Larry Wall

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.