Embedding/NewApi/Win32: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
(Added troubleshooting section)
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
== Sample using the new API and win32 ==
== Sample using the new API and win32 ==
This is a small test application using the win32 API and the new embedding API to implement a very rudimentary browser.
This is a small test application using the win32 API and the new embedding API to implement a very rudimentary browser.
You will need XULRunner headers and libraries to do this. You can build them on your own, or use XULRunner's SDK (see bottom of page)


== Prerequisites ==
== Prerequisites ==
* A build of xulrunner or firefox. A debug build is recommended during development. Here is a sample mozconfig
* A build of xulrunner or firefox. A debug build is recommended during development. More on building xulrunner can be found [http://developer.mozilla.org/en/docs/XULRunner:Build_Instructions here]. This is a sample mozconfig
<pre>
<pre>
mk_add_options MOZ_CO_PROJECT=browser,xulrunner
mk_add_options MOZ_CO_PROJECT=browser,xulrunner
Line 37: Line 38:


== Using XULRunner SDK ==
== Using XULRunner SDK ==
* [http://developer.mozilla.org/en/docs/index.php?title=Gecko_SDK xulrunner sdk].
As an alternative to building XULRunner on your own, you can use the XULRunner SDK:
* Get it from [http://developer.mozilla.org/En/Gecko_SDK xulrunner sdk].
* Set GRE_HOME to point to the xulrunner-sdk/bin folder.
* Set GRE_HOME to point to the xulrunner-sdk/bin folder.
'''Note''': There are currently some issues when building against the xulrunner sdk on win32, e.g. debug builds crash. The xulrunner sdk is using a patched win32 CRT (for jemalloc).
* '''Note''': The xulrunner sdk is using a patched win32 CRT (for jemalloc). This requires that you change the project settings to use the statically linked CRT (under "C/C++ > Code Generation > Runtime Library" and choose a non DLL library: /MT or /MTd)
 
== Troubleshooting ==
* If you get a compilation error about inability to find header files (such as "prtypes.h"), it means that you set the GRE_HOME variable after you loaded the solution. Environmental variables are loaded when each process starts, so exit Visual Studio (devenv.exe), make sure devenv.exe is unloaded, re-open the solution and try to rebuild.

Latest revision as of 15:15, 23 August 2009

Sample using the new API and win32

This is a small test application using the win32 API and the new embedding API to implement a very rudimentary browser. You will need XULRunner headers and libraries to do this. You can build them on your own, or use XULRunner's SDK (see bottom of page)

Prerequisites

  • A build of xulrunner or firefox. A debug build is recommended during development. More on building xulrunner can be found here. This is a sample mozconfig
mk_add_options MOZ_CO_PROJECT=browser,xulrunner

ac_add_options --enable-application=browser

ac_add_options --enable-debug
ac_add_options --disable-optimize
ac_add_options --enable-tests

ac_add_options --disable-installer
ac_add_options --disable-crashreporter
ac_add_options --disable-javaxpcom
ac_add_options --disable-printing
ac_add_options --disable-embedding-tests

mk_add_options MOZ_OBJDIR=@topsrcdir@/../objdir
mk_add_options MOZ_MAKE_FLAGS=-j4
  • Get the code
  • Set the environment variable GRE_HOME to point to your build's dist/bin folder

Building

There are VisualC++ solutions for both 2005 and 2008. They are found under mozembed/win32:

  • win32_test.sln for VC2005
  • win32_test_2008.sln for VC2008

Running

You need to have GRE_HOME in your path. As this might conflict with an existing firefox install, you may want to set this up in the VC debug properties. You can add a line like this under Environment:

PATH=$(GRE_HOME);$(PATH)

Using XULRunner SDK

As an alternative to building XULRunner on your own, you can use the XULRunner SDK:

  • Get it from xulrunner sdk.
  • Set GRE_HOME to point to the xulrunner-sdk/bin folder.
  • Note: The xulrunner sdk is using a patched win32 CRT (for jemalloc). This requires that you change the project settings to use the statically linked CRT (under "C/C++ > Code Generation > Runtime Library" and choose a non DLL library: /MT or /MTd)

Troubleshooting

  • If you get a compilation error about inability to find header files (such as "prtypes.h"), it means that you set the GRE_HOME variable after you loaded the solution. Environmental variables are loaded when each process starts, so exit Visual Studio (devenv.exe), make sure devenv.exe is unloaded, re-open the solution and try to rebuild.