Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: 32-bit COM server called up in 64-bit COM server


This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 1 - Last Post: Jun 30, 2015 2:08 PM Last Post By: Remy Lebeau (Te...
Kobus Schoombie

Posts: 2
Registered: 5/4/07
32-bit COM server called up in 64-bit COM server  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jun 30, 2015 4:03 AM
I have an existing custom COM server written in Delphi XE4 (sorry, no funds to keep up with all the new releases) and compiled for 32-bit platform. I now want to recompile this for a 64-bit platform. The problem is that this server calls up another server which is only available as 32-bit. I know it is frowned upon to mix 64-bit with 32-bit code, but this is the one allowed way of doing it. The 32-bit server is registered with the surrogate mechanisms provided by the operating system, so that the 64-bit app can call the 32-bit server. I use the component import wizard to build the necessary import unit from the registered type information for this 32-bit server. The end result is an auto-generated unit that calls up vcl.oleserver in its uses clause. When I try to add this unit to the 64-bit server project, I get a nasty message that oleserver is not compatible with the current project and all sorts of mayhem may ensue if I insist on using it. I have pushed through and added the problematic interface unit regardless. The 64-bit compile executed flawlessly and the server seems to be running fine. What are the issues involved here? When will this warning catch up with me and bite me in a sensitive place? Is there any workaround? Can I edit the auto-generated unit and replace vcl.oleserver with something else?
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: 32-bit COM server called up in 64-bit COM server  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jun 30, 2015 2:08 PM   in response to: Kobus Schoombie in response to: Kobus Schoombie
Kobus wrote:

I now want to recompile this for a 64-bit platform. The problem is that
this server calls up another server which is only available as 32-bit.

I assume the other server in question is an in-process server (DLL), and
not an out-of-process server (EXE), is that right?

I know it is frowned upon to mix 64-bit with 32-bit code

It is not just frowned upon, it is nearly technically impossible (well, it
IS possible, but it requires some low-level hacking to pull off, so it is
not worth the effort).

but this is the one allowed way of doing it. The 32-bit server is registered
with the surrogate mechanisms provided by the operating system, so that
the 64-bit app can call the 32-bit server.

Not directly, it is not. The surrogate runs in its own 32bit process, so
it can load the 32bit server. It then delegates access between the 32bit
server and your 64bit code. So, you are not actually mixing 32bit code and
64bit code in the same process. You are just linking 2 separate processes
together, allowing COM to marshal communications between them for you.

I use the component import wizard to build the necessary import unit from
the registered type information for this 32-bit server. The end result
is an
auto-generated unit that calls up vcl.oleserver in its uses clause. When I
try to add this unit to the 64-bit server project, I get a nasty message
that
oleserver is not compatible with the current project and all sorts of mayhem
may ensue if I insist on using it.

What is the EXACT error message? Is it an IDE popup error? A compiler error?
Please be more specific.

--
Remy Lebeau (TeamB)
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02