Question about testing a Windows dynamic link library; ask you the heroes!

xiaoxiao2021-03-06  102

Blog is your personal column, please ask for technical issues to the community. Non-technical articles, please do not check the technical category, this time I will help you, and I will delete it directly next time. --administrator.

There is a procedure:

// Test1.cpp: Defines the entry point for the console application.//

#include "stdafx.h" #include

INT Main (int Argc, char * argv []) {printf ("Hello World! / N");

Typedef int (* psleep); Hinstance HDLL; PSLEP PSLEP;

HDLL = LoadLibrary ("D: // Guangdong Construction Bank //sleep/sleep//debug//sleep.dll" ); // load dynamic link library Sleep.dll file; psleep = (psleep) getProcaddress (HDLL, "Sleep"); for (int i = 0; i <3; i ) {printf ("Sleeping for% D Seconds / N", I); PSLEEP (300);} Freelibrary (HDLL); // Uninstall MyDLL. DLL file;

Return 0;}

What is compiled?

D: / Guangdong Construction Bank /sleep/test1/test1.cpp (15): Error C2440: '=': Cannot CONVERT from 'Struct Hinstance__ *' To 'Int' This Conversion Requires a Reinterpret_cast, a c-Style Cast OR Function-Style Casterror Executing Cl.exe.

TEST1.OBJ - 2 Error (s), 0 Warning (s)

转载请注明原文地址:https://www.9cbs.com/read-124867.html

New Post(0)