?
Solved

Delphi with VC6 and DCOM

Posted on 2004-04-27
5
Medium Priority
?
322 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
2 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 1000 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses
Course of the Month13 days, 18 hours left to enroll

807 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