How to call C# DLL function from VBScript

You need to mark your assembly as COM visible by setting the COMVisibleAttribute to true (either at assembly level or at class level if you want to expose only a single type). Next you register it with: regasm /codebase MyAssembly.dll and finally call it from VBScript: dim myObj Set myObj = CreateObject(“MyNamespace.MyObject”)

When passing an array to a function in C++, why won’t sizeof() work the same as in the main function?

The problem is here: int length_of_array(int some_list[]); Basically, whenever you pass an array as the argument of a function, no matter if you pass it like int arr[] or int arr[42], the array decays to a pointer (with ONE EXCEPTION, see below), so the signature above is equivalent to int length_of_array(int* some_list); So of course … Read more

Function overloading by return type?

Contrary to what others are saying, overloading by return type is possible and is done by some modern languages. The usual objection is that in code like int func(); string func(); int main() { func(); } you can’t tell which func() is being called. This can be resolved in a few ways: Have a predictable … Read more

Calling a function from a string in C#

Yes. You can use reflection. Something like this: Type thisType = this.GetType(); MethodInfo theMethod = thisType.GetMethod(TheCommandString); theMethod.Invoke(this, userParameters); With the above code, the method which is invoked must have access modifier public. If calling a non-public method, one needs to use the BindingFlags parameter, e.g. BindingFlags.NonPublic | BindingFlags.Instance: Type thisType = this.GetType(); MethodInfo theMethod = … Read more