Now that all my framework, plugin dlls and applications are VOXPorted I try to load the plugin dlls. cmLoadLibrary seems to work since it returns a pointer != NULL. But cmGetProcAddress returns NULL_PTR. How can a load the function pointers? Or is there any other simple approach to load dlls. I have dozens of plugin dlls. So I try to avoid refactoring all of them (for now).
VAR dll := System.Reflection.Assembly.LoadFile(sDll)
FOREACH t AS System.Type IN dll:GetExportedTypes()
IF t:ToString():EndsWith("Functions") //should start with name of dll ( -> check)
FOREACH m AS System.Reflection.MethodInfo IN t:GetMethods()
IF m:Name:ToUpper() == "_DLLTYPE"
VAR n := (INT)m:Invoke(NULL, NULL)
The xxxLoadLibrary() functions can only be used to load standard windows dll files with functions, but in your case, now you are attempting to load .Net assemblies, which have a completely dirferent format and do not even have "real" functions, they only have classes and as you saw x# "functions" are only methods of a special class.
The correct way to use .Net dlls is exactly what you did, to use reflaction, also the VulcanLoadLibrary() runtime function does the same thing more or less. But it is better I think to use your own implementation as you have done it already, so you are in full control.