Extract function information from c++ dll

。_饼干妹妹 提交于 2019-12-24 09:16:19

问题


i have c++ DLL and 1 program (not code) , that program calls 1 function from DLL, i know only name of that function, now all want to call that function from my application(C#). Is it possible?

Thanks


回答1:


I'm assuming that you only have the DLL by itself, if you've got a header file as well it would be much easier since you can skip straight to figuring out how to PInvoke it.

First you have to get hold of the function signature so you know the arguments and their types. If it's a C++ DLL you might be able to get this out with Dependency Walker, if it's a C DLL, you might have to look at the actual assembly code to figure out the arguments and their types.

If you do figure out the signature, then you can use PInvoke to call it from C#, look at the PInvoke website for more details and many samples.



来源:https://stackoverflow.com/questions/3021064/extract-function-information-from-c-dll

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!