kamesh3183 has asked for the wisdom of the Perl Monks concerning the following question:

Dear Monks,

I would need to use VC++ extension dll in some perl scripts. This extension dll is written in VC++ 6.0. This dll exports a single class. I would like to create object of this class and call some functions on that object in perl script. Before I attempt to do this I have some doubts in my mind. Can somebody clarify these for me?

1. Is it possible to use VC++ extension dll in perl scripts?
2. If possible what are the modules required?
3. What are the complexities involved? (like compiler version dependencies)
4. Later on, if some changes take place in dll, what effect it will have on perl scripts?

It would be very helpful if i get some useful pointers.

Thanks
Kamesh

Replies are listed 'Best First'.
Re: using VC++ dll in perl scripts
by Corion (Patriarch) on Aug 18, 2005 at 05:55 UTC

    Depending on how the DLL in question exports the "single class", it is easy or hard to use it from Perl. If the DLL exports the "single class" as an OLE object it is very easy. To see if the DLL exports via OLE, see if you can use the class from Excel and Visual Basic. If the DLL exports the "single class" via COM or via a C pointer only, then you will have to write an XS wrapper, maybe using Inline::C, which can be hard or very hard.

    If the DLL changes but the API doesn't, you don't have to worry. If the DLL changes and the API changes, you will have to recompile your XS wrapper too.

Re: using VC++ dll in perl scripts
by rvosa (Curate) on Aug 18, 2005 at 13:58 UTC
    Yes, it may be possible to use dll's in perl scripts. You'll need Inline::C. With regard to your last two questions, it's impossible to say - could be very hard or impossible... or quite easy... Either way, this may be of interest to you: How do I access Win32 DLL-s using Inline?