[ create a new paste ] login | about

Link: http://codepad.org/Qix7z8cq    [ raw code | fork ]

C++, pasted on Jun 10:
EXE
#include <memory>
#include <functional>

__declspec(dllimport) std::unique_ptr<int, std::function<void(int*)>> Icanfly();

int main()
{
	std::unique_ptr<int, std::function<void(int*)>> p(Icanfly());
	return 0;
}

DLL
#include <iostream>
#include <memory>
#include <functional>

__declspec(dllexport) std::unique_ptr<int, std::function<void(int*)>> Icanfly()
{
	return std::unique_ptr<int, std::function<void(int*)>>(
		new int[4 * 1024 * 1024],
		[](int*p)
		{
			std::cout << __FUNCSIG__ << "\ndelete[] p" << std::endl;
			delete[] p;
		});
}


Create a new paste based on this one


Comments: