سؤال

Is it possible to use a C# assembly from Clarion? If not. Is it possible to run a simple console application written in C# and read the output from it back into Clarion? In both cases, how would you do it? In the case of the assembly, would you have to do something special with it for Clarion to get access to it? In both cases, how would you do it in Clarion?

The reason is we have two methods written in C#, which is used by an application written in C#. But we also need to use that same method in a Clarion application. And we really don't want to write the methods again for Clarion, since they are a bit complex...

هل كانت مفيدة؟

المحلول 4

Clarion is a programming language. Don't know it myself. Parts of the old system where I work is made with it, and we are working on porting it to C# .NET. So for a while they have to live side by side. We found a work around so it is no longer needed though. But thanks for info :) Maybe we will need it further down the road instead. Although I hope not... hehe.

For those curious: en.wikipedia.org/wiki/Clarion_(programming_language)

نصائح أخرى

Unless you need to display a .Net UserControl in your clarion program I would recommend using the technique described here:

Robert Giesecke - C# Project Template for Unmanaged Exports

On the Clarion side you then just link and use the .Net assembly as you would any other unmanaged DLL. I have found it convenient to load the DLL at runtime with the LoadLibrary API too.

A Clarion program will not easily or nicely call a C# DLL, though the reverse is not necessarily true.

In a project of mine, I decided to go with a minimum of coupling between a Clarion program and a C# assembly by using TCP/IP.

The idea is to have the Clarion program connect to the listening port of your mini-server, send a request and receive a reply, in the same way that a function is called with parameters and a result received.

It is easy to add a class in your C# assembly to act as a TCP/IP server. On the Clarion side, there are a handful of good templates that offer TCP/IP functionality. We have been using CapeSoft's NetTalk template for years and it is virtually rock-solid.

Depending on the urgency of your requirement, you might consider this route.

-Ray.

What is Clarion? Is it an unmanaged application? If it is, then the "something special" you would do to your assembly is called Com Interop: http://msdn.microsoft.com/en-us/magazine/cc163494.aspx

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top