3

I need help with the code below.

typedef TP_StatusType ( WINAPI * TP_UserSelectPathType )( TP_InterfaceType* anInterface, UINT32* aReturnPathId, TP_Path* aReturnPath );
extern TP_UserSelectPathType TP_UserSelectPath;

locRouterDll = LoadLibraryA( aDllFileName );
TP_UserSelectPath = (TP_UserSelectPathType)GetProcAddress( locRouterDll, "TP_UserSelectPath" );

TP_StatusType eStatus;
eStatus = TP_UserSelectPath( &eInterface, &lPathId, &xPathHandle );

Which function is called in the last line?

1
  • Perhaps I misunderstood the question; in the last line, the function TP_UserSelectPath is called, which is assigned to some external code in the first line. Commented Sep 15, 2014 at 12:30

2 Answers 2

1

Which function is called in the last line?

Well, TP_UserSelectPath is a function pointer variable that is assigned the function pointer returned by the call to GetProcAddress. So

TP_UserSelectPath(...)

calls the function named TP_UserSelectPath that is exported by the module locRouterDll. This is a function that is external to your code. The function is implemented in the module locRouterDll which was loaded into your process dynamically at runtime by the call to LoadLibraryA.

If this is all brand new to you then you should start by reading the Dynamic-Link Libraries topic on MSDN.

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

Comments

0

TP_UserSelectPath is called because you are assigning the return value of TP_UserSelectPath with the following parameters &eInterface, &lPathId, &xPathHandle to eStatus

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.