AnsweredAssumed Answered

vrf VEE and .dlls

Question asked by VRFuser on Jul 13, 2006
> I have been experimenting with C#
> and I would like to know if it
> possible to use a .dll generated
> by C# in VEE ?

Yes, but not over the CFI, through .NET. C# produces "assemblies".

> // File: Add.cs

Device->.NET Assembly References..., Browse..., select dll, Open, import namespace UtilityMethods, then:

Set ac = CreateInstance("UtilityMethods", "UtilityMethods.AddClass"); ac.Add(2, 2);

.NET is a whole different puppy. While it *can* produce executable x86 code, the code it produces is run in the Common Language Rumtime. It's never "naked" x86 code, in the sense where I can write c = a + b; in C and have the compiler produce equivalent machine language that loads a, adds it to b and stores the result in c. That DOES NOT HAPPEN in the CLR. You never, EVER touch the machine.

It works a lot like Java. Theoretically there really is no physical base machine. It's difficult to explain without getting into a lot of detail, but baiscally the code produced by C# (or any MSIL generator) runs on a pseudo-machine that the CLR emulates. That's not entirely correct, but it's the easiest way to get the point across.

You can *sort of* use C++ if you want to do OO type things over the CFI, but "this" has to be handled explicitly, wich more or less completely invalidates the advantage of C++ to begin with. It can look good in theory, but it gets very messy in the implementation.

When doing OO type things over the CFI, it's best to do what the Windows C API does: objects are represented by handles that point to data, and functions always take a handle to an object plus their other parameters. It spoils the OO illusion, but it's only an illusion anyway.
-SHAWN-

Outcomes