Importlib search order 
Author Message
 Importlib search order

MSDN has got this example how to distinguish between two different typedefs.

////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////
Importlib search order
If you import more than one type library, and if these libraries contain
duplicate references, MkTypLib resolves this by using the first reference
that it finds. MIDL will use the last reference that it finds. For example,
given the following ODL syntax, library C will use the GOO typedef from
library A if you compile with MkTypLib, and the GOO typedef from library B
if you compile with MIDL:

[...]library A
{
    typedef struct tagMOO
    {...}MOO

Quote:
}

[...]library B
{
    typedef struct tagMOO
    {...} MOO

Quote:
}

[...]library C
{
    importlib (A.TLB)
    importlib (B.TLB)
    typedef struct tagBAA
    {MOO y;}BAA

Quote:
}

The appropriate workaround for this is to qualify each such reference with
the correct import library name, like this:

typedef struct tagBAA
    {A.MOO y;}BAA

////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////

The problem that I have is that I can not get even this example to work.

To get the first case to work I have to change it to the following.

[...]library C
{
    importlib (A.TLB);
    importlib (B.TLB);
    typedef struct tagBAA
    {struct tagMOO y;}BAA;

Quote:
}

To use the actual qualifier is were my problem is. Neither

[...]library C
{
    importlib (A.TLB);
    importlib (B.TLB);
    typedef struct tagBAA
    {struct B.tagMOO y;}BAA;

Quote:
}

or

[...]library C
{
    importlib (A.TLB);
    importlib (B.TLB);
    typedef struct tagBAA
    {B.tagMOO y;}BAA;

Quote:
}

or

[...]library C
{
    importlib (A.TLB);
    importlib (B.TLB);
    typedef struct tagBAA
    {struct B.MOO y;}BAA;

Quote:
}

or

[...]library C
{
    importlib (A.TLB);
    importlib (B.TLB);
    typedef struct tagBAA
    {B.MOO y;}BAA;

Quote:
}

seems to work.

The problem seems to be that MOO is a typedef struct and not a plain data
type.
Does anybody know what the syntax should be.

Thanks
Anton



Mon, 15 Jul 2002 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. the definitive ordering of -l searches

2. level order binary search

3. Need to make compiler search directories in specific order

4. Include Search Order

5. link search order with /nodefaultlib

6. Include File Search Order

7. Include File Search Order

8. Need to make compiler search directories in specific order

9. the order of searching included files

10. (DLL,RC) search order for resource in EXE and DLL

11. VC++ 7 / ATL / importlib / msxml4

12. Difference in #import, #importlib, #include

 

 
Powered by phpBB® Forum Software