Closed Bug 180199 Opened 22 years ago Closed 15 years ago

[Mach-O] Convert plugin samples and get them building on Mach-O

Categories

(Core Graveyard :: Plug-ins, defect, P3)

PowerPC
macOS
defect

Tracking

(Not tracked)

RESOLVED FIXED
Future

People

(Reporter: peterlubczynski-bugs, Assigned: jaas)

References

Details

Plugin samples are in modules/plugin/tools/sdk/samples

1. Need to get NPAPI function table in TVector format. See attachment 104548 [details] [diff] [review]
which does this for the default plugin.
2. Need to get Makefile.in building the samples.
Priority: -- → P3
Target Milestone: --- → Future
Instead of making a new bug complaining about this, I think it would be a 
duplicate of this one so I'll just add it as a comment.

In order to get a plugin to work when built under gcc on the mac, the following 
seems to need be added to np_entry.cpp between the other two means of declaring 
the function table:

#elif defined(XP_MACOSX)
  aNPPFuncs->newp          = (NPP_NewUPP)FP2TV( (void *)NPP_New );
  aNPPFuncs->destroy       = (NPP_DestroyUPP)FP2TV( (void *)NPP_Destroy );
  aNPPFuncs->setwindow     = (NPP_SetWindowUPP)FP2TV( (void *)NPP_SetWindow );
  aNPPFuncs->newstream     = (NPP_NewStreamUPP)FP2TV( (void *)NPP_NewStream );
  aNPPFuncs->destroystream = (NPP_DestroyStreamUPP)FP2TV( (void *)
NPP_DestroyStream );
  aNPPFuncs->asfile        = (NPP_StreamAsFileUPP)FP2TV( (void *)
NPP_StreamAsFile );
  aNPPFuncs->writeready    = (NPP_WriteReadyUPP)FP2TV( (void *)NPP_WriteReady );
  aNPPFuncs->write         = (NPP_WriteUPP)FP2TV( (void *)NPP_Write );
  aNPPFuncs->print         = (NPP_PrintUPP)FP2TV( (void *)NPP_Print );
  aNPPFuncs->event         = (NPP_HandleEventUPP)FP2TV( (void *)
NPP_HandleEvent );
  aNPPFuncs->urlnotify     = (NPP_URLNotifyUPP)FP2TV( (void *)NPP_URLNotify );
  aNPPFuncs->getvalue      = (NPP_GetValueUPP)FP2TV( (void *)NPP_GetValue );
  aNPPFuncs->setvalue      = (NPP_SetValueUPP)FP2TV( (void *)NPP_SetValue );

This information would have saved me about a month's worth of ulcer.

Hopefully someone will at least find this info grepping bugzilla if the samples 
don't get fixed in the future (I stole the FP2TV function from 
ns4xPlugin.cpp:224).

mig
Oh yah, and as you might expect, you have to TV2FP moz's NPN_ function table 
back, too.

----------

I get the overwhelming feeling nobody wants people to build plugins for 
macosx.  Even after all this trouble, I can't get the XPConnect stuff to 
properly call my scriptable methods, and I can't trace into _XPTC_InvokeByIndex 
in gdb to find out why not.  As far as I can tell, moz thinks it invoked me 
properly (I can see all the params to XPTC_InvokeByIndex look good in gdb, and 
the return value is success), but my code never gets called.

If either of the two other people who get this bug tracking know what's going 
on, I'd overwhelmingly appreciate it if you could ping me about it.  

Since these other two issues have to do with assuming a different compilation 
format for functions in a plugin, I'm very worried that _XPTC_InvokeByIndex 
just isn't going to work at all for dylibs compiled with gcc (of course, if 
it's some weird stack-frame-setup issue, I would think it would crash horribly 
on me, not just silently skip my method).

mig
Nevermind, I figured it out.

Making plugins is no fun.

At all.

mig
I'm not sure we need to do any of this TVector crap any more
Blocks: 360955
Assignee: peterl-bugs → joshmoz
No longer blocks: 360955
Blocks: 360955
All the plugin samples that need to be updated have been updated. I removed some (bug 453862, bug 453857, bug 486345) and updated others (bug 453785). We have totally removed support for CFM plugins as well (bug 467417).
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.