main.h:
Code:
#ifdef MAIN_EXPORTS #define MAIN_API __declspec(dllexport) #else #define MAIN_API __declspec(dllimport) #endif #include <iostream> namespace CurlDll { class CallHost { public: static MAIN_API std::string callUrl(std::string pUrl, std::string pProxy); static MAIN_API void Try(); }; }
main.cpp
Code:
#include "main.h" #include <Windows.h> #include <curl/curl.h> namespace CurlDll { std::string CallHost::callUrl(std::string pUrl, std::string pProxy) { CURL *curl; CURLcode res; curl = curl_easy_init(); if(curl) { curl_easy_setopt(curl, CURLOPT_URL, "http://example.com"); curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L); res = curl_easy_perform(curl); if(res != CURLE_OK) fprintf(stderr, "curl_easy_perform() failed: %s\n", curl_easy_strerror(res)); curl_easy_cleanup(curl); } return "test"; } void CallHost::Try() { MessageBox(0,"lololowwwwwwwwwwwl", "wqgqwwwwwgq", MB_OK |MB_ICONINFORMATION); } }
Spätestens beim curl Kram rastet der compiler komplett aus und wirft 52 unaufgelöste externe, aber wenn man den Curl Kram weglässt und nur die Try Methode anwendet kommt auch:
Fehler 4 error LNK1120: 1 nicht aufgelöste Externe
Fehler 3 error LNK2001: Nicht aufgelöstes externes Symbol "__imp__MessageBoxA@16".
Sry aber ich steh grad etwas aufm Schlauch, ist auch ehrlich gesagt das erste mal, dass ich eine Dll mache, die einfach nur ein paar Funktionen bereitstellen soll.