开发者

How to create a DLL which exports a callback function in C using VS 2008?

开发者 https://www.devze.com 2023-03-14 23:22 出处:网络
I dont know how can I create a DLL which can export a callback function in C. I am using Visual Studio 2008.

I dont know how can I create a DLL which can export a callback function in C.

I am using Visual Studio 2008.

Can anybody help me with a good sample c开发者_C百科ode or link or tutorial.

Thanks in advance.


(1) Create DLL project (in Visual Studio). (2) List your exported functions in *.def file of your DLL. (3) Compile your DLL project.


Given you have the following function you want to export:

LRESULT CALLBACK CallWndProc( int nCode, WPARAM wParam, LPARAM lParam );

If your DLL is called HookDLL for example then you create a file called HookDLL.def with the following contents:

LIBRARY HookDLL
EXPORTS
  CallWndProc @1

This is documented here. Your alternative is with __declspec(dllexport) which is documented here.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号