1 // natMainThread.cc - Implementation of MainThread native methods.
3 /* Copyright (C) 1998, 1999, 2000, 2001, 2003 Free Software Foundation
5 This file is part of libgcj.
7 This software is copyrighted work licensed under the terms of the
8 Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
19 #include <gnu/java/lang/MainThread.h>
21 typedef void main_func (jobject
);
24 gnu::java::lang::MainThread::call_main (void)
26 Utf8Const
* main_signature
= _Jv_makeUtf8Const ("([Ljava.lang.String;)V", 22);
27 Utf8Const
* main_name
= _Jv_makeUtf8Const ("main", 4);
29 _Jv_Method
*meth
= _Jv_LookupDeclaredMethod (klass
, main_name
,
32 // Some checks from Java Spec section 12.1.4.
33 const char *msg
= NULL
;
35 msg
= "no suitable method `main' in class";
36 else if (! ::java::lang::reflect::Modifier::isStatic(meth
->accflags
))
37 msg
= "`main' must be static";
38 else if (! ::java::lang::reflect::Modifier::isPublic(meth
->accflags
))
39 msg
= "`main' must be public";
42 fprintf (stderr
, "%s\n", msg
);
46 main_func
*real_main
= (main_func
*) meth
->ncode
;