Questions tagged [midl]

1

votes
2

answer
1.9k

Views

global scope enum and namespace conflict

I have an ATL COM service and in the .IDL file, I've declared an enum like so: In Gourmet.idl typedef enum Food { Chocolate = 0, Doughnut, HotDog } Food; A header file is automatically generated, creating Gourmet_i.h. In another .CPP file (let's just call it Decadence.cpp) of the same ATL COM projec...
ykay
1

votes
2

answer
550

Views

Create COM interface returning a pointer that is marshalled as IntPtr in C#

I want to declare a COM Interface in MIDL that allows for returning a pointer (like in the ID3D11Blob). I understand that pointers are a special thing in COM because of the stubs generated for RPC calls. I do not need RPC, but only want to access the COM server from C#. The question is: can I declar...
Christoph
1

votes
1

answer
1.5k

Views

MIDL2015 warning when using importlib attribute

I have a legacy Visual Studio solution which contains several projects (has been upgraded to Visual Studio 2013). One of these projects generates a COM DLL. The TLB from this DLL is then imported into an IDL file of another project via the importlib attribute. When the MIDL compiler tries to compile...
Steiny
1

votes
1

answer
191

Views

Avoid gcc warning for (generated) tokens after preprocessing directive?

Microsoft's MIDL compiler generates C/C++ source code files that are slightly invalid, like the code in this extract: #ifndef CLSID_DEFINED #define CLSID_DEFINED typedef IID CLSID; #endif // CLSID_DEFINED #define MIDL_DEFINE_GUID(type,name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) \ const type name = {l,w1,w...
2

votes
1

answer
741

Views

Get IDL code from TypeLibrary programmatically

I am writing code to perform the following steps; Register a .net .dll and generate a .tlb using regasm.exe Register a .net .dll and generate a .tlb using regasm.exe Generate the IDL code from the typeLibrary and store it in a file. Edit the IDL code making minor changes. Recompile the IDL into a .t...
Jambobond
5

votes
1

answer
59

Views

Consecutive interface function IDs

I have a COM object interface in midl like interface InterfaceName : IDispatch { [id(1)] HRESULT FunA(...); [id(2)] HRESULT FunB(...); [id(3)] HRESULT FunC(...); } Are the ids required to be consecutive? Or can I define it like interface InterfaceName : IDispatch { [id(1)] HRESULT FunA(...); [id(3)]...
chrizke
5

votes
2

answer
1.9k

Views

MIDL generates the same file for /env win32 and /env win64

In Visual Studio, when you compile foo.idl, MIDL generates the proxy information in foo_p.c. Unfortunately, for Win32 and x64 files, it uses the same filename. For Win32, the file starts with: #if !defined(_M_IA64) && !defined(_M_AMD64) For x64, the file starts with: #if defined(_M_AMD64) When you b...
Roger Lipscombe
5

votes
2

answer
1.5k

Views

Any sense in marking an IUnknown-derived interface as dual in IDL?

Reviewing our code I've found a curious definition in one of .idl files: [ object, uuid(uuidhere), dual, nonextensible, oleautomation, hidden ] interface IOurInterface : IUnknown { //methods here }; How can an interface derived directly from IUnknown possibly be a dual interface? Will anything break...
sharptooth
2

votes
1

answer
3.3k

Views

Issues Using Midl to create a .tlb from .idl “expecting a type specification”

I have been having a prolonged encounter with the beast known as COM Interop... I am currently trying to generate a .tlb from a .idl file generated by the OLE/COM Object Viewer. However when trying to run Midl.exe to compile it I get an error: .\Sim.API.IDL(236) : error MIDL2025 : syntax error : ex...
Jambobond
1

votes
1

answer
598

Views

Can an “enum” be used for flags in COM?

In the IDL for a COM object I do the following: enum TxMyFlags { , flagOption = 1, , flagOtherOption = 2, , flagMoreOption = 4, , flagAnotherFlag = 8, , flagExtra = 128 // etc. }; and have functions that can take the sum (or bitwise-OR, same thing) of flags, e.g. (in IDL) HRESULT _std...
M.M
4

votes
1

answer
721

Views

VS2008 C++ compiler keeps asking to build the project [duplicate]

Possible Duplicate: Visual studio keeps building everything I have a project that includes an idl file that generates a .c file that is included in another file of the same project. I build this project and all is fine, I then try to run the project and I am told the project is out of date and woul...
Gary Miller
2

votes
1

answer
190

Views

Serializing std::map c++

I have an object of std::map in my VC++ application. The format of the map is as follows: map x; I want to pass this object to server through a RPC call. So, I am using MIDL for creating the client and server stubs for RPC calls. But, MIDL does not support higher level datatypes. So, is there any w...
Prerak Sola
2

votes
1

answer
1.1k

Views

COM coclass implementing interface from another type library

I'm relatively new in COM, so appologies if this is a stupid question. I'm having a bunch of COM interfaces compiled into a type library A. This type library is a resource in one of the DLLs (a.dll) in my solution. In a separate type library (B) that goes into a separate DLL (b.dll) I would like to...
themik81
5

votes
2

answer
556

Views

MIDL changes case of identifier when compiling IDL file

I've got a snippet of IDL that looks like this: [ object, uuid(...), pointer_default(unique) ] interface IVirtualMachine { /* ... */ } [ object, uuid(...), pointer_default(unique) ] interface IVirtualServer : IUnknown { HRESULT FindVirtualMachine( [in] BSTR configurationName, [out,retval] IVirtualMa...
Roger Lipscombe
3

votes
2

answer
1k

Views

MIDL marshaling array of structures using size_is in unmanaged c++

I’m trying to retrieve an array of structures through a COM interface. It works when the number of structures is 1. When the number of structures is greater than 1, only the first structure is marshaled correctly. The remaining structures in the array have garbage data. My interface looks like thi...
Ken
3

votes
1

answer
2.1k

Views

What do you do when MIDL can't create a tlb?

I am attempting to create a C# inproc server for sbtsv.idl (it is included with the Windows 8 SDK). Almost every instructions I find tell you to use MIDL to create a .tlb file then tlbimport to create the proxy dll. However, if the IDL does not include a library section no .tlb file will be generate...
Scott Chamberlain
2

votes
2

answer
1.6k

Views

How does Visual Studio determine the order to compile IDL files?

I have a COM project that contains a number of IDL files, some of which are imported into other ones. How does Visual Studio decide which ones to compile (using MIDL) first? I want to control the order. I have a master IDL file which contains my library declaration with several imports, and I get a...
M. Dudley
2

votes
1

answer
441

Views

What are the RemoteRead and RemoteWrite members of ISequentialStream?

I am developing an COM library that uses the IStream interface to read and write data. My MIDL code looks like this: interface IParser : IUnknown { HRESULT Load([in] IStream* stream, [out, retval] IParsable** pVal); }; Since IStream and it's base interface ISequentialStream are not defined inside a...
Carsten
2

votes
2

answer
144

Views

How do I write a COM dll?

To better myself I am attempting to make my dll's COM compliant, I thought I'd just need to extend/implement a few interfaces and job done but now I am at a cross roads, 1) Should I learn MIDL? 2) Should I install the ATL (I am running VC++Express)? 3) Carry on reading the C++ tutorials (http://prog...
John
5

votes
2

answer
1.2k

Views

Upgrading VS2017 from 15.4.1 to 15.5.1 resulted in build error

I'm programming with the following tools/versions: Windows 10 / VS2017 Professional / C++ After I upgraded to 15.5.1 I got the following error: MIDL2338: switches are contradictory - no_robust vs. - target The Microsoft compiler error description list says: You cannot use both the /osf and /ms_ext c...
trishm
3

votes
0

answer
2.9k

Views

Creating an IDL file from a DLL [closed]

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 possi...
Beppe
4

votes
2

answer
13.1k

Views

What is stdole2.tlb

stdole32.tlb contains all base type definitions, and every lib must import it, if we use MIDL. But when I created ATL DLL project, lib file looks like that import "oaidl.idl"; import "ocidl.idl"; [ uuid(4CA3ADAD-AE53-4D80-AF26-176BAF8223B1), version(1.0), ] library FirstATLLib { importlib("stdole2.t...
Alecs
3

votes
1

answer
655

Views

Struct inheritance in MIDL

I am trying to inherit from and extend a structure defined in MIDL. I used the same syntax as for interface inheritance i.e typedef struct stDBIBinVarDataEx { float x; } MYSTRUCT ; struct struct2 : MYSTRUCT { float y; }; but the compiler generates errors.
sreyas
1

votes
1

answer
568

Views

Invoke MIDL compiler from CMAKE

I am going to use MIDL compiler with CMAKE but unable to invoke MIDL compiler from CmakeList That is command which I use to achieve my goal add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/IFace.h ${CMAKE_CURRENT_BINARY_DIR}/GUIDS.c ${CMAKE_CURRENT_BINARY_DIR}/Proxy.c ${CMAKE_CURRENT_BINARY_DI...
definename
2

votes
1

answer
162

Views

MIDL compiler appending a custom string-valued attribute

Is it possible to suppress the MIDL compiler from appending a custom atrribute to the resulting interface definition in the resulting COM dll build? I'm suspecting that the attribute appended by MIDL compiler renders our dll to fail and cause an error: "Automation server cannot create object", due...
neolmartini
3

votes
1

answer
2.8k

Views

How do I invoke the MIDL compiler to generate a .TLB file (type library) from an .IDL file?

I am struggling with something seemingly super-simple: I'd like to use the MIDL compiler to generate a type library (.tlb file) from a .idl file. However, I just can't get MIDL to generate a .tlb file. This is my Foo.idl: import "unknwn.idl"; [object, uuid(400075B9-4BD6-45A5-B8B7-9DA0CF7B9B13)] inte...
stakx
4

votes
1

answer
1.9k

Views

Getting IDL (for TLB) from a COM+ dll when it is not provided

I have a .dll that contains some directshow filters (COM) with specific/custom interfaces to query. Most 3rd party directshow components contain embedded .tlb files that can be used for cross-enviroment communication (C# typelib import). I would hate to have to attempt to manually create the interf...
Paul Knopf
3

votes
1

answer
696

Views

midl error MIDL2379

We have a c++ library and we are auto generating COM interface for that library. so I auto generated the IDL file and everything was working fine. But over time when more interface were added to COM, We started getting the error 1> Total Format String size = 69336 1> midl : error MIDL2379: the comp...
Naveen
4

votes
3

answer
1.3k

Views

How to produce both x86 and x64 code using MIDL?

How can I generate the code for both x86 and x64 using MIDL? I've created an IDL file in Visual Studio 2010, and when I compile the product as in x86 mode and afterwards in x64 I've got to "touch" the IDL file so it will regenerate the code relevant for x64. Can I somehow tell MIDL to generate both...
DiGMi
2

votes
1

answer
3.7k

Views

midl cannot find C preprocessor cl.exe

I am trying to compile my arith.idl file with midl. I am running windows 7 pro. Here is the command I launch in a powershell prompt: PS> 'C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\midl.exe' .\arith.idl Microsoft (R) 32b/64b MIDL Compiler Version 7.00.0555 Copyright (c) Microsoft Corpor...
philippe
2

votes
1

answer
168

Views

Why does UDT / struct with missing type information cause silent launch failure in vb6?

Consider this registered type library in a DLL: [uuid(…), version(1.0)] library structLib { importlib("stdole2.tlb"); [uuid(…)] typedef struct MyStruct { BSTR m_sStr; } MyStruct; }; In vb6 I can reference this type library and use the UDT / struct in a compiled exe (simple form with a button), n...
Aurora
3

votes
2

answer
3.6k

Views

How to force MIDL compiler to use “C++ mode” instead of “C mode” in Visual Studio 2010?

My problem is simple, but I don't know how to resolve it: I have a Visual Studio 2010 project with idl files for generating COM type library. This project was originally created by VC++ 6.0. The VC 6.0 could compile this project without any error. But I converted it recently and keep trying to compi...
A.V.
4

votes
2

answer
152

Views

MIDL compile error: enum with “cy”

I have a simple IDL file which contains only one enum. One of the identifiers is cy. [ uuid(2642345F-F2AB-3600-8926-26E823800902), version(1.0), ] library MyLib { typedef[ uuid(a0b0aa7b-345f-4b3a-b88f-d6cdd048e205) ] enum Codes { cy, abc } Codes; }; However, MIDL won't compile this and gives me an...
athena
1

votes
1

answer
795

Views

Visual studio 2013 project with v120_xp toolset has MIDL 2072 error

I have recently moved to visual studio 2013 and upgrade all my c++ projects to use 8.1 of the windows SDK and the v120_xp toolset. A large majority of the projects are compiling and working fine i do however have two projects that refuse to build with several errors similar to the following error: e...
Sjblack
8

votes
1

answer
244

Views

How do I create a module defined function in a COM Type Library

The VBE7.dll type library used by VBA, has the following MIDL for the Conversion module: [ dllname("VBE7.DLL"), uuid(36785f40-2bcc-1069-82d6-00dd010edfaa), helpcontext(0x000f6ebe) ] module Conversion { [helpcontext(0x000f6ea2)] BSTR _stdcall _B_str_Hex([in] VARIANT* Number); [helpcontext(0x000f652a...
ThunderFrame
2

votes
1

answer
1.5k

Views

Missing 'ammintrin.h' when compiling Hadoop on Windows?

UPDATE-2 I have updated the Windows SDK compilers and now have reduced the errors to 2. c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\intrin.h(26): fatal error C1083: Cannot open include file: 'ammintrin.h': No such file or directory [C:\hadoop-2.7.0-src\hadoop-common-project\hadoo...
Ajay
1

votes
2

answer
3.2k

Views

MIDL compilation error (and maybe idl file generation question)

We're looking into moving our application from VS2008 to VS2010. We generate some COM objects with "attributed programming" and the IDL is automatically generated. The import directives for both files are different and the compilation fails on VS2010. on VS2008, it generates something like : impo...
Max
3

votes
3

answer
3.9k

Views

Any way to resolve C4772 errors without having to register DLLs?

I am maintaining a VS2010 project which has a number of cross-referenced COM libraries. I am trying to configure the project in such a way that it is buildable from a random workstation which has VS2010 installed. The workstation could be both 32 and 64 bit, so if I configure project to "register ou...
galets
2

votes
1

answer
668

Views

MIDL (Constant) References

Are there no constant references in MIDL method declarations???? eg. [id(1), helpstring("My Method")] HRESULT MyMethod( [in] IID & const rclsid ); for HRESULT MyMethod( IID const &rclsid );
Rebeka Fox
2

votes
1

answer
158

Views

C++ exposed property names don't match the names given in the IDL

In the IDL file for a C++ component I have something like the following, allowing the property to be COM visisble: interface IInterface { [propget, id(1), helpstring("the ID")] HRESULT ID([out, retval] long *pVal); } When I build the dll and open in OLEView I see something like this!? interface IInt...
MRAH

View additional questions