简体   繁体   中英

how to use exe project as dll?

I created some project that contains a class ( using them as object instance ). This project was POC to check some possibility -

Now I want to convert this project to dll - and import this dll to some other exe project.

I change the configuration Type of the project to "Dynamic Library ( .dll)" - and compile its ok.

But how I import this dll to my new exe project and use those classes from the other exe ?

Do I need to add some "dllExport" definition in some place on the dll project?

You will need to define a separate entry point for a DLL. An executable has the standard entry point:

int main(int argc, char* argue[], char* envy[]);

However for a Windows DLL, you need to define dllmain which will be called when the module is loaded and unloaded:

BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpReserved);

Further reading on Dynamic Link Libraries .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM