Solved

Delphi with VC6 and DCOM

Posted on 2004-04-27
5
301 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
This is a video describing the growing solar energy use in Utah. This is a topic that greatly interests me and so I decided to produce a video about it.

929 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now