4

So with a standard cpp compiler, my application links to the .lib file and then at runtime, as long as the dll is in the same folder as the executable, everything magically works..

But In python, what role does the .lib file serve? I understand you can use a dll's functions by using ctypes

from ctypes import*   
dllHandle = cdll.LoadLibrary("C:\\filename.dll") 
or
ctypes.WinDLL ("C:\\filename.dll")

But what is being lost by not using the .lib file? If it's not needed why is it necessary in cpp projects?

1 Answer 1

2

If void foo() is exported in test.dll and this function is invoked from main() in application. When you build application linking with test.lib, linker resolves call to this exported function. But another way to achieve this is by loading test.dll at runtime, get function address for void foo() and invoke that ( you can refer to http://msdn.microsoft.com/en-us/library/windows/desktop/ms683212%28v=vs.85%29.aspx). This doesn't need any linking to test.lib. In python you are doing the similar thing and test.lib plays no role here.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.