I'd bet you are building your plugin with a build project that
does not define XP_WIN. This makes for a calling convention
mismatch. Others have been tripped up by this. This would be a
Win32 only problem and would do stuff like you mention. See the
nsCOM.h declarations that hinge on the value of this define. If
this is the case for your project then add the define to your
build project and fully rebuild your code.

Attached is a patch to help people who make this mistake detect
their error. I'll try to get this into the tree sometime soon.

John.

Steven Katz wrote:
> 
> After more then a month of trying I am still unable to get out plugin to even
> regester itself with Mozilla.
> 
> I have build Mozilla debug (Win32_d.obj) version and have two versions of my
> plugin.  One built "debug", meaning with DEBUG defined for the mozilla headers
> and one without.
> 
> When I run the NON-DEBUG version the debugger shows the code crashing in the
> nsIPluginManager::RegisterPlugin() function.  The reason for the crash appears
> to be that the "this" pointer is not being passed though on the function call.
> All the function parameters seem to be off set by one (the CID show up as the
> value for the this pointer when I look at it in the debugger).
> 
> If I run the DEBUG version of the plugin I get an assert saying that the ESP
> value was not properly saved across a function call.  It then goes on to say
> things about calling functions with pointer that have different calling
> conventions..
> 
> If I try and debug this I get another box that says:
> 
> The exception Breakpoint has been reach
> 
> At this point I have no idea what is going on here.  Are these to behaviours
> really the same thing?
> 
> How can I tell where this linkage problem might be?
> 
> How is it possiblt for function parameters to be offset?
> 
> Steven Katz
> 
> BTW:  I have converted our UNIX version of our plugin to nsIModule and that is
> working fine.  Why should Windows be such a pain in the ass.
Index: nsCom.h
===================================================================
RCS file: /cvsroot/mozilla/xpcom/base/nsCom.h,v
retrieving revision 1.16
diff -u -r1.16 nsCom.h
--- nsCom.h     2001/04/20 12:18:31     1.16
+++ nsCom.h     2001/08/21 00:42:46
@@ -23,6 +23,10 @@
 #ifndef nsCom_h__
 #define nsCom_h__
 
+#if defined(_WIN32) && !defined(XP_WIN)
+#error Must define XP_WIN to build on Win32 - add XP_WIN to your project defines.
+#endif
+
 /*
  * API Import/Export macros
  */

Reply via email to