views:

88

answers:

2

I have to register a .dll file named MatchMolDLL.dll.

To register the DLL I followed these steps:

1) Goto RUN
2) Type “cmd”
3) Type “regsvr32 MatchMolDLL.dll”

However regsvr32.exe reports:

"MatchMolDLL.dll was loaded, but the DllRegisterServer entry point was not found."

How can I register it?

If I had to link this .dll file with another executable can it be done?

+1  A: 

MatchMoIDLL.dll isn't a COM DLL and you can't use regsvr32.exe to register it. It's a plain old Win32 DLL.

You can find out more about it here:

http://merian.pch.univie.ac.at/~nhaider/cheminf/cmmm.html#dll

Kev
+1  A: 

It is not a COM server. You have to use P/Invoke to use this DLL. The instructions are available in the source code file, it gives the VB6 declarations:

Private Declare Sub mm_SetMol Lib "matchmolDLL.dll" (ByVal st As String)
Private Declare Sub mm_SetCurrentMolAsQuery Lib "matchmolDLL.dll" ()
Private Declare Function mm_Match Lib "matchmolDLL.dll" (ByVal Exact As Boolean) As Long

Private Declare Function mm_GetRings Lib "matchmolDLL.dll" () As Long
Private Declare Function mm_GetAtomRing Lib "matchmolDLL.dll" (ByVal AtomNumber As Long) As Long
Private Declare Sub mm_Version Lib "matchmolDLL.dll" (ByVal st As String)

Which you'll have to translate to the corresponding VB.NET or C# [DllImport] declaration. Use "int" instead of Long in those declarations. For example:

[DllImport("matchmolDLL.dll", CharSet = CharSet.Ansi)]
private static extern void mm_SetMol(string st);

Etcetera.

Hans Passant
Nice answer. I was going to do the same but nodded off after a night of code at 7am this morning. +1
Kev