Home » Developing U++ » U++ Developers corner » Executable as DLL
Executable as DLL [message #31384] |
Sun, 27 February 2011 06:23 |
Novo
Messages: 1358 Registered: December 2006
|
Ultimate Contributor |
|
|
Executable can be used as DLL. No changes to UPP is required. A proof of this is attached.
Explanation of how this can be done on Windows.
1) Create an application, which uses UPP. Let's name it exe_dll.
#include <Core/Core.h>
using namespace Upp;
extern String test_function(int i);
CONSOLE_APP_MAIN
{
Cout() << test_function(1) << EOL;
}
2) Export required symbols via def file
EXPORTS
?FormatInt@Upp@@YA?AVString@1@H@Z
?MemoryAlloc@Upp@@YAPAXI@Z
?MemoryFree@Upp@@YAXPAX@Z
?LFree@String0@Upp@@AAEXXZ
3) Compile application. This will create an exe_dll.lib export library.
4) Create a DLL, which is not using UPP. Let's name this DLL test_dll.
#include <Core/Core.h>
using namespace Upp;
__declspec(dllexport) String test_function(int i)
{
return FormatInt(++i);
}
Although Core.h is included, DLL itself is not linked against UPP.
5) Link test_dll against exe_dll.lib. As a result you will get a test_dll.lib library.
6) Link exe_dll application against test_dll.lib.
7) run exe_dll.
This is a long way. But I believe this work-flow can be automated.
I hope this approach will be useful for the UPP community.
-
Attachment: exe_dll.zip
(Size: 166.21KB, Downloaded 349 times)
Regards,
Novo
|
|
|
Goto Forum:
Current Time: Sat May 11 13:36:15 CEST 2024
Total time taken to generate the page: 0.01543 seconds
|