I was wondering how a simple example of an exported function would look like in c# and c++.
I have made serveral tries, but I was not able to export a simple math function like c = a + b return c and import that in a naked apl.
Could anyone help me out?
Thank you in advance.
BPCS Consulting Services
The C or C++ interface is relatively well documented, even if parts of some manuals are from the last century.
What we did not manage to do in a stable way was to integrate C# via C++ (C++/CLI) into SAL:
SAL (TD Win 32) <==> C++ (C++/CLI) <==> C#
Has anyone succeeded in integrating self-made C#.NET libraries into SAL using C++/CLI?
with TD6 or newer (maybe also TD5) it is possible to write code in C# and call that from TD.
Here are the sample projects for VisualStudio and TD:
In short I did the following:
1) Create a Class Library Project (.NET Framework) with a class and a method
2) Build the dll
3) With TD: Start the .NET-Explorer and create the wrapper .apl
4) Import the wrapper .apl into your TD-project
5) Instantiate the .NET-class and call the method
[ frevel & fey ] Software-System GmbH
Yeah, that's it. But it gets funnier if you have different DLLs that you want to include with the .Net-Explorer... That can take a lot of work and nerves. There are several solutions for this, but none really satisfies you if you develop the DLLs yourself.
Also the way in which the DLLs are included is nothing else than the inclusion of a grave of methods... This has nothing to do with object-oriented programming.
You can use a TD wrapper to include the DLLs and then delete almost everything that the .Net-Explorer invented after the inclusion, so that the global part is only present once, or you can move everything to the C# side.
On the C# side, you can work with ILMerge, which we have discarded for various reasons, or you can make your own wrapper in C#, which includes the .Net DLLs and only shows the methods you want to make available to TD. This is what we finally decided to do.
However, everything still remains a grave of methods or functions - no trace of object-oriented programming. Better than pure C++ DLLs, but from the last century. So really big projects are not really feasible, let alone maintainable.
even you already found a solution I wanted to say, that I've successfully created a C++/CLR DLL that integrates well with TD and calls .NET components on the other side.
If you're still interested I could publish a blueprint on how to do that.
Nevertheless, I would be very interested to know what your solution looks like.
Best regards and stay healthy!
Who is online
Users browsing this forum: No registered users and 0 guests