Solved

Delphi with VC6 and DCOM

Posted on 2004-04-27
5
299 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
Comment Utility

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
Comment Utility
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

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…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

771 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

9 Experts available now in Live!

Get 1:1 Help Now