i have found 2 free frameworks for building Netscape Plugins using Delphi (note to people unfamiliar with delphi: you can just drop an activeX control onto a delphi form and compile it into an exe or dll) :
<
and
<
i have been playing with the first one for about two weeks and am unfamiliar with the second one. The first one allows you to create a netscape plugin from a delphi form by creating a dll project and then descending a form from a TPluginForm and then calling a register routine - it then creates a DLL which is a plugin. Putting that dll in netscape's plugin directory and then using an embed tag to view a MIME type which is mentioned in a resource file that is linked into the DLL (edit the resource file and then compile it with brcc32 and then link it into your source with {$R Plugin.rc}) - will display the form in your web page, like an ocx. I was planning to drop my ocx onto the form and then add a layer of wrapper routines to the form and then export those routines in the DLL - those wrapper functions would then invoke methods on the ocx sitting on the form. Then, according to netscape's documentation, in order to use javascript on the plugin i would create a java class which uses JNI (java native invocation) to load the dll; then i would run netscape's special javah utility (not Sun's) on the java class to create a C file which includes a "use_blahblah" routine (where blahblah is the name of your java class) - that routine would tell the java runtime environment used by netscape that the java class is "associated" with the plugin. Then when you do javascript commands on it, netscape funnels those commands to the java class which then calls the native methods, which in my case would be the routines exported in the dll. You have to call the use_blahblah routine in the framework's NP_GetJavaClass routine, which means you would have to compile the C file using a c compiler that outputs obj files in intel's OMF format (like borland compilers and unlike microsoft compilers) and then link the file into your DLL using the $L directive (because delphi can only link obj files in OMF format). I wasn't sure if this would work but i decided to give it a try. Well, the JNI works, because if i export a routine in the dll that just does a showmessage, and then create my java class which loads the dll and then executes the native routine, and then run it from the command line with "java blahblah", i see a showmessage. The linking appears to work, because i compiled the C file and linked it into the dll ok and called it ok in the getjavaclass routine. But when invoking the showmessage native routine using a javascript call it AVs and kicks me out of netscape, so i figured there was still something missing somewhere, or that i was doing something wrong. Then i noticed AVs occurring even if i commented out all the extra stuff i had added for the javascript communication; and i went back to the demo which came with the first framework above, and verified that it appeared to work ok as a plugin after i compiled it with delphi 4 and copied the dll to netscapes plugin directory and then invoked it in a web page with the embed tag. (this was the first thing i tried before doing any of the above, of course, two weeks ago, but i did it again after all this as a sanity check). Then i clicked the reload button and BOOM - i got an AV on the demo plugin. (doh ! ). This makes me think that there is a bug in the framework itself, though i am hesitant to say things like that because 99 % of the time it turns out that the problem is something you did, not the framework author. Well, anyways... its free and it includes the source, so you can't complain too much. Maybe i will examine the 2nd framework now...
i was going to post a detailed list of exactly what to do when using the first framework, as a reply to my own earlier post about writing netscape plugins in delphi (in borland.public.delphi.activex.controls.writing), so that other people wouldn't have to find all the idiosyncracies themselves (there are many, even with getting netscape's javah to work right, at least on my system...) and so that people could follow the steps without knowing java or delphi - but I would only do that once i was successful, which is not yet... but i decided to go ahead and post this if its any help, and also if anyone out there can provide suggestions with what i may be missing or forgetting to do.
other general-purpose and helpful links i have found (in no particular order) about creating plug-ins (not in delphi, however):
<
<
<
<
<
<
<
<
<