alvin wrote:
Hi Niky,

Thanks for the instructions - has helped alot.

I am just at the point where I can nearly build my own test application - but am getting some linking errors. It seems that it cannot find the proper dll's (xpcom.dll etc.)

I followed your instructions and done the following -
- built mozilla
- setup my VS environment to include the appropriate headers. (Proj. Properties->C/C++ -> General->Additional Include Directives - added libraries to be linked to the app (Proj. Properties->Linker->Input->Additional Dependancies)
- added \mozilla\dist\bin to my path
- Told linker to ignore LIBCD.lib/LIBC.lib (Proj. Properties->Linker->Input->Ignore Specific Libraries)

In addition I have done the following to make my application compile -
- Added the preprocessor tag MOZILLA_INTERNAL_API (Proj. Properties->C/C++ -> Preprocessor->Preprocessor Definitions) - Changed runtime library to MT (Proj. Properties->C/C++ ->Code Generation->Runtime Library) - Changed buffer security check to no (Proj. Properties->C/C++ ->Code Generation->Buffer Security Check) - Change so it is not using precompiled headers (Proj. Properties->C/C++ ->Precompiled Headers->Create/Use Precompiled Header) - Told linker to ignore MSVCRT.lib (Proj. Properties->Linker->Input->Ignore Specific Libraries)

Below is a snippet of the linking errors I am getting (I think problem with linking to xpcom.dll) -

Linking...
winEmbed.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __thiscall nsCOMPtr_base::assign_from_helper(class nsCOMPtr_helper const &,struct nsID const &)" ([EMAIL PROTECTED]@@QAEXABVnsCOMPtr_helper@@ABUnsID@@@Z)
..
..
C:\Documents and Settings\alvins\My Documents\Visual Studio 2005\Projects\TestEmbed\Release\winEmbed.exe : fatal error LNK1120: 12 unresolved externals


Thanks again for your help.

Alvin


Niky Williams wrote:
Ravi Dronamraju wrote:
Ravi Dronamraju wrote:

Hi,

I have programmed most of my life in the windows env and now set out to
                                     ^^^^^^^^^^^^^^^^^^
in the UNIX env. I *Never* programmed in the windows env

Help appreciated :)
build an embedded windows app.

My accomplishment :
 - I managed to compile mozilla tree on windows.

But now, i am kinda stuck. What do i do next?

- I can build and run mfcembed.exe by using "make" from cygwin
- I cannot load mfcembed project files in VS 2005 (corrupt dsp file)
- How do i use visual studio 2005 to build an embedding app?
- What kind of project within VS2005? I am guessing either mfc or CLR. - Is it better to build a CLR windows forms app that embeds mozilla or MFC?


Ravi,

Well, you have two ways to go about it really. You can use the Mozilla Active X from John Lock...or you can implement the interfaces yourself. The Active X control doesn't send back all the events, so really its best for just displaying web pages...not reacting to events like clicks and key presses (unless it's been updated recently). I choose to implement the interfaces myself, it takes a bit longer to get it setup, but you have more control over it. Which one are you going to use? In either case...below are some instructions that I've put together over the few times I've had to setup my environment for embedding Gecko (Win 2K & VS 2003). I'm not sure exactly how far along you are (I see you were able to make from cygwin the mfcembed.exe) so I'll start from the beginning, hope this helps!!

NOTE*** I've only tried this with the 1.0.7 code, not 1.5 yet.

--You've probably done all the way to step 12.
1) Download and unzip the mozilla source code
2) Download Cygwin (http://www.cygwin.com) and run...install the following packages
    a) 'make' under the 'Devel' category
    b) 'perl' under 'Interpreters' category
    c) 'unzip' under 'Archive' category
    d) 'zip' under 'Archive' category
3) Download Netscape's wintools.zip from http://ftp.mozilla.org/pub/mozilla.org/mozilla/source/wintools.zip and put that in a 'Tools' directory...or some other name you want to use. Unzip there.
    a) Run the install.bat file under the "buildtools\windows" directory
4) Next, go to ftp://ftp.mozilla.org/pub/mozilla.org/mozilla/libraries/win32/ and download the glib and libIDL version 7.1 (I THINK it's the same for VS 2005) and extract to the same dir as you did your wintools.zip file 5) Now you have to setup your environment variables for the user (right click on "My Computer" -> Properties, Advanced tab, Environment Variables button)
    GLIB = <where ever you unzipped glib>\vc71
    LIBIDL = <where ever you unzipped libIDL>\vc71
    MOZ_TOOLS = <where ever you unzipped wintools>\windows
    PATH = %GLIB%\bin;%LIBIDL%\bin;%MOZ_TOOLS%\bin
HOME = <Where ever the base dir of your project resides> //This is for CYGWIN so it knows what it's home directory is
    //Optional
    XPCOM_DEBUG_BREAK = warn
6) Create yourself a ".mozconfig" file...easiest way I've found to do it is do a "copy con" command in the cmd window just to create the file...once created, open with notepad and edit. Windows doesn't like to create names that start with a period in the explorer. 7) Mozilla.org has some good tools on creating a .mozconfig file...here is the one I use to make a browser...very simple

#-----------------------------------------------------------------
# For building firefox, this needs to be included
.. $topsrcdir/browser/config/mozconfig

# Options for client.mk.
mk_add_options MOZ_CO_PROJECT=browser

# Options for 'configure' (same as command-line options).
ac_add_options --enable-application=browser
ac_add_options --enable-crypto #-----------------------------------------------------------------

8) Make a shortcut to vsvars32.bat created by the VS.Net app, this will setup some things for building 9) Rename the link.exe in your Cygwin/bin to something else...like link.exe.old 10) run the vsvars32.bat, browse to where you installed Cygwin and run the Cygwin.bat file. 11) Once it's up and running, navigate to the mozilla dir (where you unzipped the mozilla code) and run "./configure" 12) Once that is done, run "make -f client.mk build" to start the building process.

Now to setup the VS environment to build...I use straight Win32, so I create a blank project when I start this.
After you have your blank project setup, do the following:
Directories the project needs to know where to search for include files:
    \mozilla\dist\include\layout
    \mozilla\dist\include\dom
    \mozilla\dist\include\uriloader
    \mozilla\dist\include\profdirserviceprovider
    \mozilla\dist\include\string
    \mozilla\dist\include\necko
    \mozilla\dist\include\gfx
    \mozilla\dist\include\docshell
    \mozilla\dist\include\widget
    \mozilla\dist\include\webbrwsr
    \mozilla\dist\include\windowwatcher
    \mozilla\dist\include\embed_base
    \mozilla\dist\include\nspr
    \mozilla\dist\include\xpcom

These libraries also need to be linked to your app
    xpcom.lib
    embed_base_s.lib
    nspr4.lib
    profdirserviceprovider_s.lib

Also add \mozilla\dist\lib to the list of directories it looks in for libraries for the project

Also add \mozilla\dist\bin to your PATH environment variable so it will know where to find xpcom.dll, etc...

Tell the linker to ignore LIBCD.lib (Debug mode)/LIBC.lib (Release mode)

Whew...okay, I think thats it. My notes are a little old so they may be a little quirky but that is the basic steps of what I do to get my environment setup for embedding gecko. Good Luck!!

Niky Williams

Alvin,
I left Code Generation on Sigle Thread for mine...not sure if this will make a difference, also I didn't have to define the preprocessor MOZILLA_INTERNAL_API. I do remember fiddling with single/multiple thread at one point...but I can't remember why. I looks like you have everything pointing correctly so it can find everything okay...are you building with 1.5 or 1.0.x? I tried building with 1.5 at one point, but it needed some additional libs linked with the project...I didn't have time to fiddle with it, so I stayed with 1.0.x since I needed something up pretty quickly. Off the top of my head, I don't have any suggestions . If I think of something, I'll reply back.

Niky Williams
_______________________________________________
dev-embedding mailing list
dev-embedding@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-embedding

Reply via email to