3

I'm working on a VB6 graphical interface that make use of a DLL generated from a C code that makes use of __declspec(thread) variables. The problem is that because of a known limitation, it is not possible to dynamically link this dll in the VB6 project.

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

I'm able to generate the .tlb file until I have to specify functions that contain struct 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 the row: int myFunct([in] myStruct data); the compiler says:

syntax error: expecting a type specification near "myStruct"

Is there a way to make it works? Like some kind of struct declaration in the IDL file?

Thank you,

G.B.

SOLVED here by wqw. Thanks

Community
  • 1
  • 1
Beppe
  • 381
  • 2
  • 7
  • 15
  • What does the C function signature of the DLL look like? What is "the bug" that prevents dynamic linking in the first place? – selbie Mar 07 '11 at 09:06
  • @selbie Hi, I didn't understand the first question, sorry. Regarding the limitation you can find the explanation at http://support.microsoft.com/kb/118816 – Beppe Mar 07 '11 at 09:44
  • @David Thank you, I already fixed the question. – Beppe Mar 07 '11 at 09:47
  • Closed as localized as you have solved the problem, eliminating any answers being posted. – Tim Post Mar 08 '11 at 11:49

0 Answers0