Solved

Delphi with VC6 and DCOM

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Reconfigure Delphi Install? 2 60
Adoquery sql  left join does not work 25 98
MS Access from Delphi 31 60
DBCtrlGrid, Delphi, Scroll 7 26
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…
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…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

840 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