Creating an IDL File from a DLL

I am working on a VB6 GUI using a DLL built from C code using variables __declspec(thread). The problem is that due to a known limitation, it is not possible to dynamically link this DLL in a VB6 project.

So, as suggested in the discussion of this , a possible solution is to create an IDL file from the DLL, compile it using the MIDL compiler, and then reference the .tlb result in the VB6 project.

I can generate a .tlb file until I specify functions containing structure variables

[
  uuid(YOURTYPE-LIBG-UIDH-ERE0-000000000000),
  version(1.0),
  helpstring ("My Type Library 1.0")
]
library MyTypeLib
{
    importlib("stdole2.tlb");

    [dllname("OLEAUT32")]
    module OleAut32
    {
        [entry("myFunct")]
        int myFunct([in] myStruct data);
    };
};

At line: the int myFunct([in] myStruct data);compiler says:

syntax error: expecting a type specification near "myStruct"

Is there any way to make it work? How some kind of structure declaration in an IDL file?

Thank,

GB

SOLVED here by wqw. Thanks

+3

All Articles