Calling a DLL from C#
-
HI All, I am trying to call a function from a dll. One of its parameters is a structure that I will need later to call another function from another dll but the problem is that I don't know its detailed structure to be able to marshall it in C#. I am not interested in accessing the struc:confused:ture's attributes,it's a temporary step for me before calling the other function. However,it must be accuartely done in order to pass a correct argument to the other function. Can I just marshal the unknow datatypes within the structure as it they were "void"? Any ideas or suggestions? It's really has been puzzling me for a time now and I can't reach a solution Thanks and Best Regards, E.A.
-
HI All, I am trying to call a function from a dll. One of its parameters is a structure that I will need later to call another function from another dll but the problem is that I don't know its detailed structure to be able to marshall it in C#. I am not interested in accessing the struc:confused:ture's attributes,it's a temporary step for me before calling the other function. However,it must be accuartely done in order to pass a correct argument to the other function. Can I just marshal the unknow datatypes within the structure as it they were "void"? Any ideas or suggestions? It's really has been puzzling me for a time now and I can't reach a solution Thanks and Best Regards, E.A.
IF the dll is a Microsoft one, then pinvoke.net[^] might help. Either way, it would give you examples showing how this is done. Christian Graus - Microsoft MVP - C++
-
IF the dll is a Microsoft one, then pinvoke.net[^] might help. Either way, it would give you examples showing how this is done. Christian Graus - Microsoft MVP - C++
-
HI All, I am trying to call a function from a dll. One of its parameters is a structure that I will need later to call another function from another dll but the problem is that I don't know its detailed structure to be able to marshall it in C#. I am not interested in accessing the struc:confused:ture's attributes,it's a temporary step for me before calling the other function. However,it must be accuartely done in order to pass a correct argument to the other function. Can I just marshal the unknow datatypes within the structure as it they were "void"? Any ideas or suggestions? It's really has been puzzling me for a time now and I can't reach a solution Thanks and Best Regards, E.A.
If you know the total size of the structure and if the contents of the structure dont matter, then you can try allocating memory equal to the size of the structure and pass the pointer to the memory as a void parameter instead of marshalling it as a structure. -Atul, Sky Software http://www.ssware.com Shell MegaPack For ActiveX & .Net - Windows Explorer Like Shell UI Controls
-
If you know the total size of the structure and if the contents of the structure dont matter, then you can try allocating memory equal to the size of the structure and pass the pointer to the memory as a void parameter instead of marshalling it as a structure. -Atul, Sky Software http://www.ssware.com Shell MegaPack For ActiveX & .Net - Windows Explorer Like Shell UI Controls