<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Hi Ramu,</div><div><br></div><div>Frankly this doesn't make a lot of sense to me, but from I gather you're trying to create a release (aka target system) and want to know how to start your 'project' up without using a gen_server. OTP is predicated on the concept of an 'Application' - see <a href="http://erlang.org/doc/design_principles/applications.html">http://erlang.org/doc/design_principles/applications.html</a> for details - and without this, you will be hard pressed to build a release. Your application does not have to be built using gen_server, but there ought to be a top level supervisor or at a minimum, a top level process that is to be run.</div><div><br></div><div>Aside: think about this like you would a Java or .NET (or python/ruby/perl/etc if you) program. You will start the program from some main class (or script) and this must block the main thread in order to prevent the program from terminating - so you will spawn some background thread(s) to do the actual work - and in many cases if you're running inside of some kind of container (like a web application server e.g., tomcat/weblogic, IIS, tornado, etc) or framework (like WCF/fuse/camel/mule/twisted/event-machine/etc) so you just implement the 'callback' part of the contract and the framework/container does the rest.</div><div><br></div><div>It is necessary to have your code running in a process, and whilst you can forgo using gen_servers and supervisors if you really wish to, you will still need to spawn a process in which your application shall run. There is such a thing as a library application, which has no start module. You can achieve this by removing the 'mod' element from your application resource file, like so:</div><div><br></div><div>%% foobar.app</div><div><div>{application, foobar,</div><div> [</div><div> {description, ""},</div><div> {vsn, "0.0.1"},</div><div> {applications, [kernel, stdlib]}</div></div><div> ]}.</div><div><br></div><div>In this case however, because your library (i.e., an 'inactive' application) has no startup function - because there is no application callback module - there is no way to initialise the start state. This option is really intended for library code that has no state, hence the name.</div><div><br></div><div>I would strongly suggest reading the documentation, especially the system and design principles, before trying to build a target system in a non-standard way. I would also highly recommend reading <a href="http://learnyousomeerlang.com/">http://learnyousomeerlang.com/</a>, especially the section <a href="http://learnyousomeerlang.com/building-applications-with-otp">http://learnyousomeerlang.com/building-applications-with-otp</a>, before proceeding.</div><div><br></div><div>Cheers</div><div>Tim </div><br><div><div>On 5 Mar 2012, at 05:19, raamu eppa wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Hi,<div><br></div><div>In my erlang files there is no option for start OTP gen_server.But i want to create my project as a target system.</div><div>Is there any option for creating target system without using OTP gen_server.</div>
<div>Iam starting my project as,</div><div><div style="">mongodb:init([]).</div><div style="">sendmail:send_message("your option").</div></div><div><br></div><div>Thanks,</div><div>Ramu.</div>
_______________________________________________<br>erlang-questions mailing list<br><a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>http://erlang.org/mailman/listinfo/erlang-questions<br></blockquote></div><br></body></html>