Well, it seems to work now. I made a typo in the javascript communicating to the component :-)

Regards,
Sjoerd

Sjoerd van Leent wrote:
Alright, I got it so far that it now finds the DLL (seemed that I used the wrong Gecko SDK), however, The function call, which I now conveniently made to be "int getHelloWorld()" still doesn't seem to be fetched.

Also:

How can I dump a class and interface so that I now which methods are implemented?

Regards,
SJoerd

Sjoerd van Leent wrote:

Hi all,

I downloaded the latest gecko-sdk, which provided me with the most needed tools. I made a simple C++ implementation of a fairly simple "nsIHelloWorld" interface, only containing a "string GetHelloWorld()" method. This all goes well, see for code below.

All together it builds a DLL file called helloworld.dll and a .xpt file of the IDL interface. When pulling them into the components directory I run regxpcom to register both of them.

Now my components directory looks like:

components >
  ...
  helloworld.xpt
  helloworld.dll
  ...
  compreg.dat
  xpti.dat

This seems Okay. When digesting through the xpti.dat file, I clearly see that helloworld.xpt was found (yay), however, when looking into compreg.dat I can't find helloworld.dll.

My question: Where to put the helloworld.dll file, and how to register it properly, so it is usable with firefox/gecko.

Some extra information:
firefox: release 1.0 (release version)
os: windows (and linux, same problem)

Regards,
Sjoerd

--- CODE HelloWorld.cpp ---

#include "mozilla-config.h"
#include "nsIGenericFactory.h"
#include "nsXPCOM.h"
#include "nsIHelloWorld.h" // My generated IDL

#define nsHelloWorld_CID \
{0x777f7150, 0x4a2b, 0x4301, \
{0xad, 0x10, 0x5e, 0xab, 0x25, 0xb3, 0x22, 0xaa}}

#define nsHelloWorld_ContractID "@svanleent/nsHelloWorld"

char *helloWorld = "Hello World!";

class nsHelloWorld : public nsIHelloWorld
{
public:
    NS_DECL_ISUPPORTS
    NS_DECL_NSIHELLOWORLD
    nsHelloWorld();

private:
    ~nsHelloWorld();
};

NS_IMPL_ISUPPORTS1(nsHelloWorld, nsIHelloWorld)

nsHelloWorld::nsHelloWorld()
{
  /* member initializers and constructor code */
}

nsHelloWorld::~nsHelloWorld()
{
  /* destructor code */
}

/* string GetHelloWorld (); */
NS_IMETHODIMP nsHelloWorld::GetHelloWorld(char **_retval)
{
    *_retval = helloWorld;
    return NS_OK;
}

/*!
* Register the components
*/
static NS_METHOD nsHelloWorldRegistration(nsIComponentManager *aCompMgr, nsIFile *path, const char *registryLocation, const char *componentType, const nsModuleComponentInfo *info) {
/* Initialize service */


    return NS_OK;
}

/*!
* Unregister the components
*/
static NS_METHOD nsHelloWorldUnregistration(nsIComponentManager *aCompMgr, nsIFile *path, const char *registryLocation, const nsModuleComponentInfo *info) {
/* Uninitialize service */


    return NS_OK;
}

NS_GENERIC_FACTORY_CONSTRUCTOR(nsHelloWorld)

static const nsModuleComponentInfo components[] = {
    {
        "nsHelloWorld",
        nsHelloWorld_CID,
        nsHelloWorld_ContractID,
        nsHelloWorldConstructor,
        nsHelloWorldRegistration,
        nsHelloWorldUnregistration
    }
};

NS_IMPL_NSGETMODULE(nsHelloWorldModule, components)
_______________________________________________
Mozilla-xpcom mailing list
[email protected]
http://mail.mozilla.org/listinfo/mozilla-xpcom

Reply via email to