Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Widgets - General questions or Mixed problems » gui in dll does not compile
gui in dll does not compile [message #43566] Mon, 01 September 2014 13:09 Go to next message
aftershock is currently offline  aftershock
Messages: 143
Registered: May 2008
Experienced Member
Hi,


I have a simple dll... I thought I would put the gui there

#include <CtrlLib/CtrlLib.h>
#include <windows.h>
#include "ultimatewindll.h"

using namespace Upp;

BOOL APIENTRY DllMain(HANDLE hModule, DWORD reason, LPVOID lpReserved)
{
switch (reason) {
case DLL_PROCESS_ATTACH:
break;
case DLL_PROCESS_DETACH:
break;
case DLL_THREAD_ATTACH:
break;
case DLL_THREAD_DETACH:
break;
}
return TRUE;
}

DllExport void PromptOK2(char * Str)
{

PromptOK("Hello world");
}




When I compile
----- ultimatewindll ( DLL SSE2 GUI MAIN MSC9 WIN32 MSC ) (8 / Cool
cd d:\m\upp\ultimatewindll
Linking...
link -nologo -machine:I386 -pdb:" d:\upp4_6_2014\out\MyApps\MSC9.Dll.Gui.Sse2\ultimatewindll.p db " -out:"d:\upp4_6_2014\out\MyApps\MSC9.Dll.Gui.Sse2\ultimatewi
ndll.dll" -incremental:no -release -OPT:REF,ICF -subsystem:windows -DLL -LIBPATH:"C:\Program Files (x86)\Microsoft Visual Studio 9.0\Vc\Lib" -LIBPATH:"C:\Pro
gram Files\Microsoft SDKs\Windows\v7.0\Lib" " d:\upp4_6_2014\out\MyApps\ultimatewindll\MSC9.Dll.Gui.Main.S se2\ultimatewindll.obj " "d:\upp4_6_2014\ou
t\MyApps\CtrlCore\MSC9.Dll.Gui.Sse2\CtrlCore.obj" "C:\Program Files\Microsoft SDKs\Windows\v7.0\Lib\advapi32.lib" "C:\Program Files\Microsoft SDKs\Windows\v7
.0\Lib\comdlg32.lib" "C:\Program Files\Microsoft SDKs\Windows\v7.0\Lib\comctl32.lib" "C:\Program Files\Microsoft SDKs\Windows\v7.0\Lib\user32.lib" "C:\Progra
m Files\Microsoft SDKs\Windows\v7.0\Lib\gdi32.lib" " d:\upp4_6_2014\out\MyApps\CtrlCore\MSC9.Dll.Gui.Sse2\CtrlCor e.lib " "C:\Program Files\Microsoft SDKs\Windo
ws\v7.0\Lib\user32.lib" "C:\Program Files\Microsoft SDKs\Windows\v7.0\Lib\gdi32.lib" "d:\upp4_6_2014\out\MyApps\Draw\MSC9.Dll.Gui.Sse2\Draw.lib" "d:\upp4_6_2
014\out\MyApps\plugin\bmp\MSC9.Dll.Gui.Sse2\BmpReg.obj" " d:\upp4_6_2014\out\MyApps\plugin\bmp\MSC9.Dll.Gui.Sse2\bmp.l ib " "d:\upp4_6_2014\out\MyApps\RichText\
MSC9.Dll.Gui.Sse2\RichImage.obj" " d:\upp4_6_2014\out\MyApps\RichText\MSC9.Dll.Gui.Sse2\RichTex t.lib " "C:\Program Files\Microsoft SDKs\Windows\v7.0\Lib\kernel
32.lib" "C:\Program Files\Microsoft SDKs\Windows\v7.0\Lib\user32.lib" "C:\Program Files\Microsoft SDKs\Windows\v7.0\Lib\ws2_32.lib" "C:\Program Files\Microso
ft SDKs\Windows\v7.0\Lib\advapi32.lib" "C:\Program Files\Microsoft SDKs\Windows\v7.0\Lib\shell32.lib" "C:\Program Files\Microsoft SDKs\Windows\v7.0\Lib\winmm
.lib" "C:\Program Files\Microsoft SDKs\Windows\v7.0\Lib\mpr.lib" "d:\upp4_6_2014\out\MyApps\Core\MSC9.Dll.Gui.Sse2\Core.lib" "d:\upp4_6_2014\out\MyApps\plugi
n\z\MSC9.Dll.Gui.Sse2\z.lib" " d:\upp4_6_2014\out\MyApps\plugin\png\MSC9.Dll.Gui.Sse2\pngre g.obj " "d:\upp4_6_2014\out\MyApps\plugin\png\MSC9.Dll.Gui.Sse2\png.
lib" "C:\Program Files\Microsoft SDKs\Windows\v7.0\Lib\kernel32.lib" "C:\Program Files\Microsoft SDKs\Windows\v7.0\Lib\user32.lib" "C:\Program Files\Microsof
t SDKs\Windows\v7.0\Lib\advapi32.lib" "C:\Program Files\Microsoft SDKs\Windows\v7.0\Lib\shell32.lib" "C:\Program Files\Microsoft SDKs\Windows\v7.0\Lib\winmm.
lib"
Creating library d:\upp4_6_2014\out\MyApps\MSC9.Dll.Gui.Sse2\ultimatewindll.l ib and object d:\upp4_6_2014\out\MyApps\MSC9.Dll.Gui.Sse2\ultimatewindll.e xp
ultimatewindll.obj : error LNK2019: unresolved external symbol "void __cdecl Upp::PromptOK(char const *)" (?PromptOK@Upp@@YAXPBD@Z) referenced in function _P
romptOK2
d:\upp4_6_2014\out\MyApps\MSC9.Dll.Gui.Sse2\ultimatewindll.d ll : fatal error LNK1120: 1 unresolved externals

I get unresolved external..
I guess it could be a bug....
Or can you tell me how to resolve this?


A.
Re: gui in dll does not compile [message #43567 is a reply to message #43566] Mon, 01 September 2014 14:44 Go to previous messageGo to next message
andreincx is currently offline  andreincx
Messages: 15
Registered: March 2014
Promising Member
Hi aftershock,

Could you please post also the content of 'ultimatewindll.h'?

#ifndef _UppDll_UppDll_h
#define _UppDll_UppDll_h

#define DllImport extern "C" __declspec(dllimport)
#define DllExport extern "C" __declspec(dllexport)

#ifdef flagDLL
	#define DLLIMPORT __declspec(dllexport)
#else
	#define DLLIMPORT __declspec(dllimport)
#endif

DLLIMPORT void PromptOK2(char* str);

#endif


#include <CtrlLib/CtrlLib.h>

#include <windows.h>
#include "UppDll.h"

using namespace Upp;

BOOL APIENTRY DllMain(HANDLE hModule, DWORD reason,  LPVOID lpReserved)
{
	switch (reason) {
	case DLL_PROCESS_ATTACH:
			Ctrl::InitWin32(AppGetHandle());
			AppInitEnvironment__();
		break;
	case DLL_PROCESS_DETACH:
		Ctrl::ExitWin32();
		break;
	case DLL_THREAD_ATTACH:
		break;
	case DLL_THREAD_DETACH:
		break;
	}
	return TRUE;
}

DLLIMPORT void PromptOK2(char* str)
{
	PromptOK(str);
}


This should work. See Ctrl::InitWin32(AppGetHandle()); and AppInitEnvironment__(); in DLL_PROCESS_ATTACH and Ctrl::ExitWin32() in DLL_PROCESS_DETACH. If you don't have to put anything else in DllMain you may use DLL_APP_MAIN to hide U++ initialization and cleanup.

When you use it don't forget to add path to directory where *.lib file of dll is.

Regards,
Andrei
Re: gui in dll does not compile [message #43568 is a reply to message #43567] Mon, 01 September 2014 15:39 Go to previous messageGo to next message
aftershock is currently offline  aftershock
Messages: 143
Registered: May 2008
Experienced Member
#ifndef _ultimatewindll_ultimatewindll_h
#define _ultimatewindll_ultimatewindll_h

#define DllImport extern "C" __declspec(dllimport)
#define DllExport extern "C" __declspec(dllexport)

#ifdef flagDLL
#define DLLIMPORT __declspec(dllexport)
#else
#define DLLIMPORT __declspec(dllimport)
#endif

#endif
Re: gui in dll does not compile [message #43569 is a reply to message #43567] Mon, 01 September 2014 15:42 Go to previous messageGo to next message
aftershock is currently offline  aftershock
Messages: 143
Registered: May 2008
Experienced Member

#include <CtrlLib/CtrlLib.h>

#include <windows.h>
#include "UppDll.h"

using namespace Upp;

BOOL APIENTRY DllMain(HANDLE hModule, DWORD reason,  LPVOID lpReserved)
{
	switch (reason) {
	case DLL_PROCESS_ATTACH:
			Ctrl::InitWin32(AppGetHandle());
			AppInitEnvironment__();
		break;
	case DLL_PROCESS_DETACH:
		Ctrl::ExitWin32();
		break;
	case DLL_THREAD_ATTACH:
		break;
	case DLL_THREAD_DETACH:
		break;
	}
	return TRUE;
}

DLLIMPORT void PromptOK2(char* str)
{
	PromptOK(str);
}


This should work. See Ctrl::InitWin32(AppGetHandle()); and AppInitEnvironment__(); in DLL_PROCESS_ATTACH and Ctrl::ExitWin32() in DLL_PROCESS_DETACH. If you don't have to put anything else in DllMain you may use DLL_APP_MAIN to hide U++ initialization and cleanup.

When you use it don't forget to add path to directory where *.lib file of dll is.

Regards,
Andrei[/quote]

You seem to find other problems with the code.. That is good, thanks
However, one problem seems to be
unresolved external symbol "void __cdecl Upp::PromptOK(char const *)" (?PromptOK@Upp@@YAXPBD@Z) referenced in function _P
romptOK2
meaning some libraries and I mean part of standard upp library is not added to the linker as far I can see it.
That is why I thought it could be a bug or i did not use a compilation flag...
What do you think why?
Re: gui in dll does not compile [message #43570 is a reply to message #43566] Mon, 01 September 2014 19:16 Go to previous message
aftershock is currently offline  aftershock
Messages: 143
Registered: May 2008
Experienced Member
Ctrllib package was missing.
Previous Topic: mixed RichEdit widget with MFC Dialog.
Next Topic: ColumnList multi select mode: weird behavior
Goto Forum:
  


Current Time: Thu Mar 28 14:02:26 CET 2024

Total time taken to generate the page: 0.01406 seconds