[mapserver-dev] linking with COM dll

Tamas Szekeres szekerest at gmail.com
Thu Mar 20 15:58:43 EDT 2008


Robert,

I wonder if you could do the following steps in your dll to invoke
your COM component:

1. Initialize the COM libraries (CoInitializeEx with COINIT_APARTMENTTHREADED)
2. Create an instance of the COM object (CoCreateInstance) or get a
reference of an existing object (CoGetObject)
3. Invoke the method(s) using the reference you get. I you have an
IDispatch interface you can use it's Invoke function or some other
functions if you have a custom or dual interface.

You can use a typelib viewer to see what kind of interface you have to
invoke actually. There might also be some other issues related to how
the parameters are marshalled.

You could also use ATL to make the things much easier.


Best regards,

Tamas




2008/3/20, ROBERT HOLLINGSWORTH <reh2 at prodigy.net>:
> hello all,
> we're building a mapserver plugin dll for a custom vector source, so that
> client apps such as ArcMap and Geomedia can access this source thru WMS.
> This as an alternative to using a proprietary ActiveX client plugin in IE.
>
> anyway, my plugin dll is dependent on libmap.dll at runtime and therefore
> links with mapserver_i.lib.  so far so good.
>
> But we also want to link with a COM dll that has been built in MSVC/C++6 and
> one of the functions we want to use has a return param that is a complex
> object/"collection"/"VARIANT" type that will be foreign to the conventional
> C in mapserver.
>
> We couldn't link to the import library of this COM dll, so we had to create
> a parallel straight-C version without the VARIANT object, and were able to
> link with its import lib and run with the dll just fine.
>
> But this is an unwanted parallel creation that we want to retire.
>
> Question: does anyone know how I might make use of the COM dll in my
> mapserver plugin, which I'm building in Visual Studio .NET 2003 ("vc7" I
> guess).  A wider exploration has given me hints of such things as functions
> LoadLibrary( ) and GetProcAddress( ), plus there's the dlopen( ) that
> mapserver uses to grab my plugin, if that is of any help here.
>
> thanks from an old UNIX programmer,
> REH
>
> _______________________________________________
>  mapserver-dev mailing list
>  mapserver-dev at lists.osgeo.org
>  http://lists.osgeo.org/mailman/listinfo/mapserver-dev
>
>


More information about the mapserver-dev mailing list