PC Review


Reply
Thread Tools Rate Thread

Legacy clients with LoadLibrary calling services implemented in C#

 
 
Skip Sailors
Guest
Posts: n/a
 
      3rd Feb 2004
I would like to implement a service in C#, and I would like clients
without even COM support to make calls to it. Clients have
LoadLibrary support. What is my best strategy?

TIA
 
Reply With Quote
 
 
 
 
Tian Min Huang
Guest
Posts: n/a
 
      4th Feb 2004
Hello,

Thanks for your post. As I understand, you want to load a managed C#
service from a legacy clients by calling LoadLibrary. Please correct me if
there is any misunderstanding. I'd like to share the following information
with you:

We are not able to export function from managed program, because it
requires a valid consistent function to call into which .NET Framework does
not support. Managed code has no concept of a consistent value for a
function pointer because these function pointers are proxies that are built
dynamically.

To work around the problem you should use COM Interop to call .NET
Component from unmanged application. Please refer to the following articles
and sample:

COM Interop Sample: COM Client and .NET Server
http://msdn.microsoft.com/library/de...us/cpguide/htm
l/cpconcominteropsamplecomclientnetserver.asp

COM Interoperability in Visual Basic and Visual C#
http://msdn.microsoft.com/library/de...us/vbcon/html/
vbconcominteropinvisualbasicvisualc.asp

I look forward to your feedback.

Have a nice day!

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

 
Reply With Quote
 
Skip Sailors
Guest
Posts: n/a
 
      4th Feb 2004
(E-Mail Removed) (Tian Min Huang) wrote in message news:<(E-Mail Removed)>...
> ...
>
> We are not able to export function from managed program, because it
> requires a valid consistent function to call into which .NET Framework does
> not support. Managed code has no concept of a consistent value for a
> function pointer because these function pointers are proxies that are built
> dynamically.
>
> To work around the problem you should use COM Interop to call .NET
> Component from unmanged application. Please refer to the following articles
> and sample:
>
> COM Interop Sample: COM Client and .NET Server
> http://msdn.microsoft.com/library/de...us/cpguide/htm
> l/cpconcominteropsamplecomclientnetserver.asp
>
> COM Interoperability in Visual Basic and Visual C#
> http://msdn.microsoft.com/library/de...us/vbcon/html/
> vbconcominteropinvisualbasicvisualc.asp
> ...


You understand my question.

My best strategy, then, is to present the .NET component as a COM
service, then implement a Win32 DLL to bridge the inteface gap between
the COM and the client that can't do COM.
 
Reply With Quote
 
Skip Sailors
Guest
Posts: n/a
 
      4th Feb 2004
(E-Mail Removed) (Tian Min Huang) wrote in message news:<(E-Mail Removed)>...
> ... As I understand, you want to load a managed C#
> service from a legacy clients by calling LoadLibrary. Please correct me if
> there is any misunderstanding. I'd like to share the following information
> with you:
>
> We are not able to export function from managed program, because it
> requires a valid consistent function to call into which .NET Framework does
> not support. Managed code has no concept of a consistent value for a
> function pointer because these function pointers are proxies that are built
> dynamically.
>

....
Another strategy I just thought of is to write my wrapper in C++ and
used mixed-mode. Managed to get to the C# component and unmanged to
present the API to legacy clients. That would work, wouldn't it?
 
Reply With Quote
 
Tian Min Huang
Guest
Posts: n/a
 
      5th Feb 2004
Hello,

Thanks for your reply. I am not sure why your client that can't do COM. If
it's a Visual C++ client application, you can call the COM component
directly as described in the following MSDN sample:

COM Interop Sample: COM Client and .NET Server
http://msdn.microsoft.com/library/de...us/cpguide/htm
l/cpconcominteropsamplecomclientnetserver.asp

In the meantime, I believe that the best strategy is to use VC++
implementing a Win32 DLL.

Please feel free to let me know if you have any problems or concerns.

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

 
Reply With Quote
 
Skip Sailors
Guest
Posts: n/a
 
      7th Feb 2004
(E-Mail Removed) (Tian Min Huang) wrote in message news:<(E-Mail Removed)>...
> Hello,
>
> ... I am not sure why your client that can't do COM...

My client is a third-party tool with its own scripting language that
allows for extensions implemented in C DLLs. I don't have the source
code, so I have limited control over how this tool interfaces with
extensions.

Here's a similar kind of problem. Could you present a C# extension
usable in Word 2.0?
 
Reply With Quote
 
Tian Min Huang
Guest
Posts: n/a
 
      9th Feb 2004
Hello,

Thanks for your information.

>> Could you present a C# extension usable in Word 2.0?

I appologize that I am not sure what you mean exactly, could you please
tell me more detailed information?

I am standing by for your reply.

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

 
Reply With Quote
 
Skip Sailors
Guest
Posts: n/a
 
      9th Feb 2004
(E-Mail Removed) (Tian Min Huang) wrote in message news:<(E-Mail Removed)>...
> Hello,
>
> Thanks for your information.
>
> >> Could you present a C# extension usable in Word 2.0?

> I appologize that I am not sure what you mean exactly, could you please
> tell me more detailed information?
> ...

I mean, suppose you have a program that was written in the 1980s. It
has a scripting language and is designed to support the Win32 APIs for
LoadLibrary and GetProcAddress, but does not have support for
CreateObject. I likened this to an old version of Word that had
WordBasic. Maybe not a good analogy.

I have such a tool. I can LoadLibrary and GetProcAddress, but I
cannot CreateObject. I am trying to hack together a way for .NET
component extnesions to this tool.
 
Reply With Quote
 
Tian Min Huang
Guest
Posts: n/a
 
      10th Feb 2004
Hi,

Thanks a lot for your clarification. Since the client does not support COM
client, I agree with you that it would be better to create Win32 DLL to
bridge the inteface gap between the .NET component and your client.

Please feel free to let me know if any further I can help.

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Legacy ASP calling C# assembly Gilgamesh Microsoft C# .NET 3 9th Nov 2007 09:35 AM
Calling Legacy C function from Managed C++ briankirkpatrick@cox.net Microsoft VC .NET 11 16th Aug 2007 08:14 PM
Calling C DLL in Web Service using LoadLibrary/GetProcAddress? Siegfried Heintze Microsoft VB .NET 1 25th Jun 2004 11:18 PM
Terminal Service and Legacy Clients Dexter Microsoft Windows 2000 Terminal Server Clients 1 30th Jan 2004 10:51 PM
Performance calling from .NET to legacy COM DLL steve clark Microsoft Dot NET 1 11th Sep 2003 09:26 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:35 PM.