This project has moved. For the latest updates, please go here.

Use of MathNetNumerics in Visual basic 6.0 application

Mar 19, 2013 at 12:58 PM
Dear all,

I am a new member of your community and I am very interested in using
Math.Net Numerics in a Visual Basic 6.0 application.
Unfortunately, I cannot register the MathNet.Numerics.dll by using the
regasm.exe and therefore there is no opportunity to use them in any
COM-based applications.
I always get the following error when applying the regasm tool on the dll:
RegAsm : warning RA0000 : No types were registered

I did some research on the internet and found some possible solutions why this error might be raised but all the solutions cannot be applied from my site.

But I can´t believe that nobody from the community has ever used the dll in a COM-based application so that I wanted to use the discussion platfom to get advice from you.

Is there an opportunity to register the MathNetNumerics.dll successfully so that any COM application can use it?

Thank you in advance for your support!

Best regards,
DialM
Coordinator
Mar 19, 2013 at 4:53 PM
Hi,

Math.NET Numerics does not support COM directly. In fact, for large parts it cannot possibly support COM due to its nature.

However, what may work in your case is to expose the functionality you need on a higher level as COM-Visible application services (interface + class) in a tiny library written in VB.Net or C#, which then uses Math.NET Numerics internally to implement your functionality the normal way. This library could then be registered and consumed in VB6 as usual.

Thanks,
Christoph
Marked as answer by cdrnet on 10/3/2013 at 5:47 PM
Mar 20, 2013 at 7:29 AM
Hi Christoph,

thanks for your reply!

Well, I assumed when I would get an asnwer that I get this one.
I also figured out that if it is not possibly to operate with the library to
write a kind of wrapper like you described in your post.

May I be able to provide all interfaces and classes from MathNetNumerics
directly via my wrapper so that I could use it this way:

foomatrix = new <wrapper name>.DenseMatrix();

Is this possible?

Other wise I have to implement the function I need in the way you
exactly described. I would use my own little library for the work that must be done
with the MathNetNumerics and deliver the results back to my main program
(COM application).

Thank you !

Best regards,
DialM
Coordinator
Mar 20, 2013 at 10:23 AM
Hi,

Unfortunately, linear algebra and the Matrix type in particular is where I suspect direct COM would not work well if at all. Although note that while I do have used VB6 and COM quite intensively in the past as well, I haven't touched it at all for 10 years, so I might confuse things e.g. with ".Net Remoting" (where such a direct approach would perform very badly).

Maybe someone with more recent experience with COM .Net interop can chime in?

All in all I guess a small service library operating on a higher level (i.e. your domain, instead of pure math), as discussed, may likely work and perform best, with the added bonus that Math.NET would not leak into your application. But of course that depends on your scenario and architecture.

Thanks,
Christoph

PS: When working with matrices and vectors you may want to leverage Matrix.Storage to access raw data directly, so you can transport pure arrays over COM without converting between them all the time.