
999 S.W.2d 474 (1999)
Edward Jerome GREEN, Appellant,
v.
The STATE of Texas, State.
No. 2-98-553-CR.
Court of Appeals of Texas, Fort Worth.
July 22, 1999.
Rehearing Overruled August 30, 1999.
*475 Chris Raesz, Denton, for Appellant.
Bruce Isaacks, Crim. Dist. Atty., Pamela J. Moore, Gracie Rodriquez, Chance Oliver, Asst. Dist. Attys., Denton County, Matthew Paul, State Pros. Atty., Austin, for Appellee.
Panel D: DAY, LIVINGSTON, and DAUPHINOT, JJ.

OPINION
SAM J. DAY, Justice.
Appellant raises two points alleging that the trial court erred in denying the relief sought in his pretrial application for writ of habeas corpus. We dismiss for want of jurisdiction.

BACKGROUND
Appellant was charged with evading detention. He filed a pretrial application for writ of habeas corpus alleging that the provision under which he was charged, penal code section 38.04, is unconstitutionally vague. TEX. PENAL CODE ANN. § 38.04 (Vernon 1994 & Vernon Supp.1999). On September 9, 1998, the trial court held a hearing and denied appellant relief. On November 2, 1998, appellant then entered into a plea-bargain agreement in which he pleaded nolo contendere in exchange for 45 days' confinement.

DISCUSSION
There are two ways a defendant can challenge, in the trial court, the facial constitutionality of a statute. Appellant may file a pretrial motion asking the trial court to declare the statute unconstitutional. See, e.g., Williams v. State, 937 S.W.2d 479, 491 (Tex.Crim.App.1996) (addressing on appeal the claim that the trial court erred in failing to grant the defendant's pretrial motion to declare death penalty scheme unconstitutional). When a defendant files a pretrial motion, any ruling on the motion is interlocutory, and is not subject to immediate appeal. See Ex parte Apolinar v. State, 820 S.W.2d 792, 794 (Tex.Crim.App.1991); McKown v. State, 915 S.W.2d 160, 161 (Tex.App.Fort Worth 1996, no pet.); see also Scott v. State, 158 Tex.Crim. 69, 253 S.W.2d 275, 276 (1952) (interlocutory orders not appealable).
*476 The other procedure for challenging the constitutional validity of a penal code provision before trial is via a pretrial application for writ of habeas corpus. See, e.g., Ex parte Boetscher, 812 S.W.2d 600, 601 (Tex.Crim.App.1991); Ex parte Meyer, 172 Tex.Crim. 403, 357 S.W.2d 754, 756 (1962). In fact, the very nature of the claim that appellant makes herethat a statute is unconstitutionally void for vaguenesshas been addressed on appeals from pretrial applications for writ of habeas corpus. See Ex parte Anderson, 902 S.W.2d 695, 698 (Tex. App.Austin 1995, pet. ref'd); Ex parte Luster, 846 S.W.2d 928, 930 (Tex.App. Fort Worth 1993, pet. ref'd); Ex parte Guerrero, 811 S.W.2d 726, 727 (Tex.App. Corpus Christi 1991, no pet.). When a trial court denies relief from a pretrial habeas corpus application, the applicant may take immediate appeal. See Ex parte McCullough, 966 S.W.2d 529, 531 (Tex. Crim.App.1998); Waldie v. State, 923 S.W.2d 152, 157 (Tex.App.Beaumont 1996, no pet.).
In this case, appellant chose to challenge the validity of section 38.04 by filing a pretrial application for writ of habeas corpus, instead of a pretrial motion to declare section 38.04 unconstitutional. The trial court, after a hearing, denied the requested relief. Therefore, the trial court's denial was immediately appealable. See McCullough, 966 S.W.2d at 531; Waldie, 923 S.W.2d at 157.
Under the rules of appellate procedure, appeal must be perfected within 30 days of the date the appealable order is entered. See TEX.R.APP. P. 26.2(a)(1).[1] There was no motion for new trial, thus appellant's notice of appeal from the order denying him habeas relief was due on or before October 9, 1998. Appellant filed his notice of appeal on November 4, 1998. Therefore, appellant's notice of appeal is untimely and does not invoke this court's appellate jurisdiction regarding the trial court's order on the pretrial application for writ of habeas corpus. See Olivo v. State, 918 S.W.2d 519, 522 (Tex.Crim.App.1996).
Appellant's notice of appeal, however, is timely regarding the final judgment entered on November 2, 1998. But, because appellant entered into a plea bargain, he must meet the special notice requirements of rule 25.2(b)(3). TEX.R.APP. P. 25.2(b)(3). Appellant does not appeal a jurisdictional issue, nor has the trial court granted him permission to appeal. See id. 25.2(b)(3)(A), (C). Thus, in order to appeal his conviction, appellant's notice must truthfully state that the substance of his appeal was raised by written motion and ruled on before trial. Appellant's notice does not, and in fact can not, meet this requirement.
We recognize that appellant's notice of appeal states that the substance of the appeal was raised by written motion and ruled on before trial. For this to be true, however, the pretrial habeas corpus application must be a "written motion" as contemplated in rule 25.2(b)(3). Our review of applicable law reveals that it is not.
A pretrial motion is to be filed at a pretrial hearing conducted pursuant to article 28.01 of the code of criminal procedure. TEX.CODE CRIM. PROC. ANN. art. 28.01 (Vernon 1989). At such a hearing, the defendant may file any motions or pleadings that are by law permitted to be filed, including a motion to declare a statute unconstitutional. See id. art. 27.02; see, e.g., Williams, 937 S.W.2d at 491. The purpose of the pretrial hearing is to enable the judge to dispose of certain matters prior to trial and thus avoid delays during the trial. See Johnson v. State, 803 S.W.2d 272, 284 (Tex.Crim.App.1990), cert. denied, 501 U.S. 1259, 111 S.Ct. 2914, 115 L.Ed.2d 1078 (1991). Rulings on pretrial motions are interlocutory and not subject to immediate appeal. See Scott, 253 S.W.2d at 275.
*477 A habeas corpus action is separate from the proceeding out of which it arises and its purpose is vastly different. Habeas corpus is by definition an extraordinary writ in which the restraint of one's liberty is challenged as illegal. See TEX.CODE CRIM. PROC. ANN. art. 11.01 (Vernon 1977); Saucedo v. State, 795 S.W.2d 8, 9 (Tex. App.Houston [14th Dist.] 1990, no pet.). As one of our sister courts has noted:
Habeas corpus proceedings are separate and distinct proceedings independent of the cause instituted by the presentation of an indictment or other forms of the State's pleadings. Such habeas corpus proceedings should be docketed separately from the substantive cause and given a different cause number. An appeal from an order denying relief is not an interlocutory appeal from the substantive cause arising out of an indictment, felony information, or complaint and information.
Ex parte Shumake, 953 S.W.2d 842, 846 n. 8 (Tex.App.Austin 1997, no pet.). Additionally, the purpose of a pretrial habeas corpus application is not to facilitate trial, but to stop trial and secure immediate release from confinement.
Because of the important differences noted, we conclude that a pretrial application for writ of habeas corpus is not the same as a matter "raised by written motion and ruled on before trial" for the purpose of rule 25.2(b)(3). Here appellant opted to file a pretrial application for habeas relief. He did not immediately appeal the order denying him relief. Appellant then pleaded nolo contendere without filing any pretrial motions. Thus, while appellant's notice of appeal textually reflects compliance with rule 25.2(b)(3)(B), the statement is inaccurate because there are no pretrial motions in this case. Appellant therefore fails to meet the special notice requirement of rule 25.2(b)(3)(B) and, as a result, fails to invoke this court's jurisdiction over the judgment and sentence in this case. See Long v. State, 980 S.W.2d 878, 878 (Tex.App.Fort Worth 1998, no pet.).

CONCLUSION
Because any purported appeal from the order denying habeas relief is untimely and because appellant otherwise fails to invoke our appellate jurisdiction, we dismiss this appeal for want of jurisdiction.
NOTES
[1]  If there is a motion for new trial, appeal must be perfected within 90 days.
