How do I link to a DLL from javascript in XULRunner? - dll

I have a dll (that I didn't write) and I would like to use it in an XULRunner application. I know nearly nothing about this, so bear with me. Apparently I can use XPCOM to load the dll and then call functions in it. How would I do that?

Or you could wait until xulrunner includes js-ctypes and call the DLL directly.

Related

Get FileVersionInfo interop wrapped COM dll - need full path

I need to present an "About" style dialog about a COM dll that my .NET application is calling via interop. I've seen solutions for using GetFileVersionInfo on a currently loaded assembly, and also pInvoke style GetModuleHandle then querying calls. But since I'm using interop, in my loaded modules list I don't see it directly, just my interop dll.
If I use FileVersionInfo(filename) and have the full path to the dll, I get exactly what I need - however as the user will have control over where they install this COM dll, I can only think of querying the registery to get this full path. Can anyone see a better solution? Previous version of this product was a native application and thus loaded the dll directly.
Any ideas or is querying the registry the best choice?

Create VB6 application using a class in a DLL, then swap out that DLL after build?

so my question is relatively simple, can I create VB6 application that references a class in a dll, and then substitute that dll for another at runtime?
Now my intial guess is... no chance in VB6.
So my thoughts turned to a VB.net interop dll. Could I do it in here, and then call the interop dll from the VB?
Again, my guess would be no.... but I'd be happy if someone knew differently.
The only thing that I think would actually work would be DI in .Net, but I'm limited to .net 2, or 3.5 at a big push, so I dont know if that is possible.
So for the background....
I have a dll that a specific site uses, but we dont want to ship that out to everyone. Instead, we want to build a clone dll which just has the interfaces setup so that the VB6 build will complete.
When it gets to the site that needs it, they want to replace the dummy dll, and drop in their version instead.
Note: We do use RegFreeCOM when its gets installed, so I do have the manifest files that I could play around with if needed.
Any ideas would be much appreciated.
Nick
Its a COM dll so its not statically linked to the VB6 exe, so long as the clsids and interface ids are the same in the type library for both DLLs, you can swap them around as you see fit. (If its a VB6 dll this is trivial to do with the 'binary compatibility' build option)
You could also use late binding instead and instead of making a reference directly in your VB6 code, you would create an object and then set that object to an instance.
Examples and information:
MVPS
Microsoft

link dll functions at runtime

My program requires some function in a dll at runtime. How do I tell where the dll is? I can copy the dll into the program directory or system 32. Is there other neat way of doing this? Thank you. Also I am working in C++.
Are you using native code (C/C++/Delphi) or .NET? You should see my answer to Call Function from Dynamic Library for an example of how to do this with a native (not .NET) DLL.

Referencing DLLs for Objective-C (GNUStep on Windows)

How do you reference DLLs from Objective-C? I use GNUStep Make files on Windows.
RIch
Ooh... this takes me back. A bit of a guess from the most common problem I ever ran into.
If GNUStep's DLLs on Windows work like they did a decade ago, then you:
Link to the DLL like you would any other DLL. I don't remember the explicit syntax, but there should be about a zillion examples available
Make sure you have a static reference to a symbol in each DLL from the main program (or from some other DLL).
In particular, when compiling something that is pure Objective-C, it is quite easy to end up in a situation where the Windows link loader doesn't load a DLL because it doesn't see a hard reference to any symbol in that DLL. When I ran into this with WebObjects applications, I would typically export something like:
int businessLogicDLLVersion;
And then refer to that symbol quite specifically in my main program. That static reference was enough to cause the link loader to load the DLL and the runtime to hook up all the classes.

Alternative to DLL's as objects (dynamically replaceable objects)

I have an application that uses many different .NET managed DLL's as objects (each DLL implements a common interface). Each DLL also has a version number in the file name.
Suppose I create the object "Shape~01.dll." The application will use that DLL but it can't be replaced while the application is running. So, if I want to "upgrade" the shape dll I have to create "Shape~02.dll" and the application has to dynamically search for and load the newest dll everytime a shape is created and/or the user has to restart the application. It get's worse, each dll depends on the main .exe thus has to be rebuilt with the main .exe.
Is there an easier method to have dynamically "replaceable" objects?
Well, this isn't the best solution (still thinking about it), but you can unload dll files which will allow them to be replaced. That might be a quick stopgap solution until you come up with a better idea.
You don't mention which language/platform you are trying to accomplish this in, so I will answer for the .NET Framework.
If you want to do it the hard way look at Shadow Assemblies, this is the method that ASP.NET uses to keep the site updateable though it is using the files.
For a much easier method look at the new System.Addin namespace, this uses Shadow Assemblies under the hood and should do what you want.
Instead of polling when creating an object, why not just request notification from the system when the file system changes?
The class is System.IO.FileSystemWatcher in.NET.
For native code there are a few ways to watch a folder, but IANAND (I am not a native developer ;).
Although having said those things, you probably want to rethink the reason you need to change your objects so frequently, because it will probably take a lot of work to make it work.
You used the dynamic tag, so maybe you should try a dynamic language? :)