// test.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include"main.h"
#include<stdlib.h>
#pragma comment(lib,"main.lib")
void MyFuction();
void MyFunction1();
class student
{
public:
student()
{
printf("student\n");
pfn = MyFuction;
}
};
student st;
void MyFunction1()
{
printf("myfunction1\n");
}
void MyFuction()
{
printf("hello");
system("pause");
}
//==================================mian ib 库函数 ===============================//
//main.cpp
#include"stdafx.h"
#include"main.h"
#include<stdlib.h>
void(*pfn)() = NULL;
int main()
{
if(pfn!=NULL)
pfn();
printf("hide main function");
system("pause");
return 0;
}
//main.h
#include"stdafx.h"
extern "C" void(*pfn)();#include"stdafx.h"
extern "C" void(*pfn)();
运行结果截图