4

I'm stuck on trying generating a new version of a COM DLL with binary compatibility. I don't understand why I get this message :

'init' in the 'Logger' class module has arguments and/or a return type that is incompatible with a similar declaration in the version-compatible component.

Original definition:
 Function init(aLOGDIR As String, Optional aListBox As Object, Optional aMAXLISTBOXLINES As Integer) As Boolean

Current definition:
 Function init(aLOGDIR As String, Optional aListBox As Object, Optional aMAXLISTBOXLINES As Integer) As Boolean

I haven't change init as you can see...

Here's my steps :

  • First generation without compatibility
  • Set up a binary compatibility in Project properties (referencing the previous generated dll with or without renaming it)
  • Second generation
  • Warning occurs.

Is this because a parameter is an Object ? Thanks for your help.

Amessihel
  • 5,891
  • 3
  • 16
  • 40
  • 2
    I don't think it's because the parameter is an Object, no. I've googled around a bit and find that there's an old bug that will give this message when you have a reference to a Form object in your arguments. It may be that you're encountering the same bug because of the ListBox control. Although you're casting it as an Object. Anyway, the workaround is to ignore the message. Perhaps you can go ahead and preserve compatibility and test everything and see if it works? – BobRodes May 25 '15 at 20:06
  • Thanks for your reply, indeed it's a form Object I forgot to tell about it. I'll try and make a feed back. – Amessihel May 26 '15 at 10:02

1 Answers1

1

In my experience, when trying to get VB6 working with COM or C++, one must pay careful attention to the differences in data-types. I'm guessing this might be your issue. I apologize if you are already familiar with this:

aLOGDIR As String implies a char**; consider changing to ByVal aLOGDIR As String, though I doubt this is relevant to your issue.

Optional aMAXLISTBOXLINES As Integer implies a short and not an int. Certain padding issues could arise, but simply changing it to As Long might be sufficient and fix the issue.

As Boolean implies a short and not a bool on systems. It might be safer to just use As Long.

Mike Weir
  • 3,094
  • 1
  • 30
  • 46