Solved

Delphi with VC6 and DCOM

Posted on 2004-04-27
5
303 Views
Last Modified: 2010-05-18
Hi!

I have to do a VC++ 6 Client to a Delphi Server over DCOM.

I know how to do with both VC6 client and server with IDL, but how to do with Delphi!

Does it have a VC++ readable typelib to generate C++ stubs??? what else?

please help
0
Comment
Question by:zuse01
5 Comments
 
LVL 26

Expert Comment

by:Russell Libby
ID: 10928569

Using Delphi's type library editor, you can save the tlb information as IDL/MIDL, at which point your VC tools should be able to bring this in and generate the stubs for you. (You don't even need the Delphi source, as the tlb editor can open compiled exe/dll/tlb files)

Regards,
Russell
0
 
LVL 2

Accepted Solution

by:
PatrickMMartin earned 250 total points
ID: 10933371
I think you need to generate the COM server and simply reference the library using #import. This is the most direct and straightforward route, and lets you just run make and nmake in sequence to get the latest executables.

from the BCB documentation:

Syntax

#import "filename" [attributes]

or

#import <filename> [attributes]


Where attributes are added as follows:

attribute1, attribute2, ...

or

attribute1 attribute2 ...

Description

The #import directive is used to incorporate information from a type library. The content of the type library is converted into C++ classes, mostly describing the COM interfaces.

Note:      The #import directive is included for Microsoft compatibility only. Its use is generally not recommended. You should use the Import Type Library command or TLIBIMP.EXE when importing type libraries.

The filename is the name of the file containing the type library information and can be one of the following types:

Type library (.TLB or .ODL) file
      Executable (.EXE) file
      Library (.DLL) file containing a type library resource (such as .OCX)
      Compound document holding a type library
      Other file format understood by the LoadTypeLib API

The filename is a file or full pathname and must be an existing file. The difference between the two syntaxes implies a difference in the order in which the preprocessor searches for the type library files when the path is not completely specified.

The quoted syntax instructs the preprocessor to first look for type library files in the same directory of the file that contains the #import statement, and then in the directories of whatever files that include (#include) that file. The preprocessor then searches according to the paths specified for the angle-bracketed syntax.

For the angle-bracketed syntax, the compiler searches the following directories for the file:

PATH environment variable path list
      LIB environment variable path list
      Path specified by the –I (include directories) compiler option
You can optionally include one or more attributes in the #import directive. These attributes modify the contents of the type library headers. The #import attributes are listed below:

#import attributes

exclude      high_method_prefix
high_property_prefixes      implementation_only
include(…)      inject_statement
named_guids      no_auto_exclude
no_implementation      no_namespace
raw_dispinterfaces      raw_interfaces_only
raw_method_prefix      raw_native_types
raw_property_prefixes      rename
rename_namespace

The #import directive instructs the compiler to generate two header files: filename.tlb and filename.tli, where filename is the name referenced in the #import directive. These header files contain C++ type specifications derived from the indicated type library: structures, enums, unions, interfaces, and dispatch interfaces. The .tli file is included by the .tlb file and contains implementations for interface invocation methods. The two header files are stored in the object file output directory.

C++Builder compiles the #import directive according to Microsoft specifications. If you have problems with the compilation in Visual C++, the same problems are likely to occur in C++Builder.

Refer to the Microsoft Visual C++ documentation for additional details on using the #import directive.
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question