Archived

This topic is now archived and is closed to further replies.

ao

Compiler

Recommended Posts

ao    122
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

Share this post


Link to post
Share on other sites
gmcbay    130
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.).

Share this post


Link to post
Share on other sites
TUna    122
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

Share this post


Link to post
Share on other sites
Muzzafarath    146
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

Share this post


Link to post
Share on other sites
bishop_pass    109
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

Share this post


Link to post
Share on other sites
Staffan    122
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

Share this post


Link to post
Share on other sites
bishop_pass    109
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.

Share this post


Link to post
Share on other sites
ao    122
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

Share this post


Link to post
Share on other sites
bishop_pass    109
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.



Share this post


Link to post
Share on other sites
ao    122
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

Share this post


Link to post
Share on other sites
bishop_pass    109
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.



Share this post


Link to post
Share on other sites
Muzzafarath    146
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

Share this post


Link to post
Share on other sites