Heres the situation I'm trying to create a program that will read a string and use that string to dll a function in a dll.
See this
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
private delegate void MessageBoXy(string a, string b);
UnmanagedLibrary test = new UnmanagedLibrary("Test.dll");
MessageBoXy testX = test.GetUnmanagedFunction<MessageBoXy>("Testy");
testX.DynamicInvoke("Hello there", "lol");
When i use DynamicInvoke my "Test.dll" is called and MessageBoxA
is executed from the dll using the strings passed through c#....
Thats all well and good but heres where the thing i need help with comes in....
You see this private delegate void MessageBoXy(string a, string b);
its static and cannot be changed..... Now i need the program to read a string and change return value and params for the Delegate.... For example
I want to read a string like "Call Test.dll RETURN string PARAMS int, int, char, string"
Now it should be possible to infinitely expand the params and create the delegate for it then call the function in the DLL.
Im making a kind of macro program and i want the user to be able to enter a DLL a return value and params then call the dll so i have no idea what params or return value will be required by the user so the c# code must be able to create any delegate i need.
What do I need?
I need a class or an example that shows me how to spawn the object set a return value, set params then call the object using an array of object[] which will become the params such as myFunc(string a, string b)
will be created and object[0] will be param 1 and so on....
The bottom line is i need to be able to dynamically call dll files from user made scripts.