|
Hi, I 'm trying to import a template class from dll A to another one, dll B, where I'm subclassing it and instantiating it. However I get the following linking error:
xmlCoreBuilder error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall MAGE::Builder<class mage::scene="">::Builder<class mage::scene="">(void)" (__imp_??0?$Builder@VScene@MAGE@@@MAGE@@QAE@XZ) referenced in function "public: __thiscall xmlCoreBuilder::SceneBuilder::SceneBuilder(void)" (??0SceneBuilder@xmlCoreBuilder@@QAE@XZ)
In the following error Builder is the base template class defined in dll A and SceneBuilder is a specialized sub-class of the former defined in dll B. I get the linking error when creating an instance of the sub-class in dll B:
xmlCoreBuilder::SceneBuilder* b = new xmlCoreBuilder::SceneBuilder;
I'm suspecting that I might have that problem because I export a template class, but I'm not sure. Can you think of anything?
Thank you,
Themis
|
|
|
|
|
Hello,
You can't export template classes. This is because code is generated at compile time and DLL's work at runtime. The only way to 'export' templates is to provide the source code. This needs to be in the header file anyway..
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
DLL A:
BldT.h:
template<class TT> class BldT {...};
typedef BldT<long> BldLong;
#include "BldT.i"
BldT.i:
template<class TT>
BldT<TT>::BldT( void ) {...}
...
BldT.cpp:
// The following will export all methods from BldT<long> template instance
template class __declspec(dllexport) BldT<long>;
DLL B:
SBld.h
class ScnBld : public BldLong {...};
You will still need to access BldT.h from DLL B to compile.
However, you shouldn't need to provide BldT.i and can remove the #include "BldT.i" from the BldT.h that DLL B uses.
...cmk
Save the whales - collect the whole set
|
|
|
|
|
what is wrong in this code? thank you
#include "stdafx.h"
#include "windows.h"
typedef HANDLE(*pAdd)(LPCSTR,DWORD,DWORD,LPSECURITY_ATTRIBUTES,DWORD,DWORD,HANDLE);
pAdd pfAdd;
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
// TODO: Place code here.
HANDLE g_hCapFile;
HINSTANCE hDLL;
hDLL = LoadLibrary("c:\\winnt\\system32\\kernel32.dll");
pfAdd = (pAdd)GetProcAddress(hDLL,"CreateFileA");
g_hCapFile=(*pfAdd)("c:\\ftp\\pippo",GENERIC_WRITE,FILE_SHARE_READ|FILE_SHARE_WRITE,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
return 0;
}
bocbe
-- modified at 10:50 Friday 11th November, 2005
|
|
|
|
|
The windows.h should have been included in the stdafx.h
There is no check that handle to DLL is null prior to trying to get procedure address.
There is no check that pfAdd is not NULL prior to using it as a pointer to a function.
The freaking path to kernel32.dll is hard coded!
I have several Windows XP installations, and the OS is on drive H:
There may be others, but this is enough to make me wonder if the softwae programmer knows what he is doing
|
|
|
|
|
|
In addition to the lack of error checking, what is the value of g_hCapFile after the call to CreateFileA() ? If it is INVALID_HANDLE_VALUE , then what does GetLastError() return?
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
In this code only at the last line the system (if you try in debug mode) will give you the error: "calling convention is wron
bocbe
|
|
|
|
|
Hi All,
I have a makefile project and I want to call COM (ActiveX control) in the project.
The code to call COM in makefile is as follows:
Files included for COM support are:
#include <objbase.h>
#include <comdef.h>
#include <rpc.h>
#include <rpcndr.h>
#include <basetyps.h>
//I am just putting the COM calling code let me know if I m doing the right way.
HRESULT hr = CoInitialize(NULL);
if(FAILED(hr))
{
printf("CoInitialize Failed\n");
return 0;
}
IMyInterface* pInt = NULL;
hr = CoCreateInstance(CLSID_MyInterface, NULL, CLSCTX_INPROC_SERVER, IID_IMyInterface, reinterpret_cast<void**> (&pInt));
if(SUCCEEDED(hr))
pInt->Connect(); //This is the COM funtion that I want to use
pInt->Release();
CoUninitialize();
It compiles fine but when I try to build it gives me Linking Error...
MyClass.OBJ : error LNK2001: unresolved external symbol __imp__CoUninitialize@0
MyClass.OBJ : error LNK2001: unresolved external symbol __imp__CoCreateInstance@20
MyClass.OBJ : error LNK2001: unresolved external symbol __imp__CoInitialize@4
MyApplication.EXE : fatal error LNK1120: 3 unresolved externals
NMAKE : fatal error U1077: 'link' : return code '0x460'
Please help me on this. Thanks in advance.
Ashok
|
|
|
|
|
Sounds like you need to add ole32.lib to the project's lib files.
|
|
|
|
|
Hi community,
how can i write to clipboard memory, for example, strings with ctrl + c, and put them with ctrl + v in to an textfield???
How to use this memory???
thanx a lot!
break;
|
|
|
|
|
|
When I start my mdi application a new document always appears without pressing the new tab. Does anyone know how can I prevent this from happening?
Furthermore how can I make the application start in a maximized window??
Thanks.!
|
|
|
|
|
1°) Question
In the InitInstance():
....
// Parse command line for standard shell commands, DDE, file open
CCommandLine cmdInfo;
ParseCommandLine(cmdInfo);
......
.....
// DON'T display a new MDI child window during startup!!!
cmdInfo.m_nShellCommand = CCommandLineInfo::FileNothing; /// This is
2°) Question
In the InitInstance():
Replace the line
pMainFrame->ShowWindow(m_nCmdShow); with pMainFrame->ShowWindow(SW_SHOWMAXIMIZED);
Too many plans make the health badly!!
|
|
|
|
|
Thanks very much
|
|
|
|
|
How to replace data parameter in a report with RDC...
Someone has some idea on like changing the parameters of a report to Runtime ??
Thanks in advance.
Too many plans make the health badly!!
|
|
|
|
|
Is it possible to build a C++ Windows Forms application using form designer in VS .NET 2003 and use it on a system which does not have .NET framework installed?
Thanks!
|
|
|
|
|
Ciprian Cana wrote: Is it possible to build a C++ Windows Forms application using form designer in VS .NET 2003 and use it on a system which does not have .NET framework installed?
No, it its not.
Windows Forms is the morale equivalent to the WIN32/MFC API in .NET.
You get the stuff behind the scenes only by installing the .NET Framework - which you are allowed to redistribute.
"We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation."
-- Caius Petronius, Roman Consul, 66 A.D.
|
|
|
|
|
I created a menu and accelerator keys but these(accelerator keys) are not working when I am operating thru key board.
please tell me the reason why? and how can I overcome the problem?
chakit
|
|
|
|
|
If your working within MFC, you have to make sure that your accelerator table ID matches that of your document resource id, the same way you have to for the menu and doducment description string
IDS_MYDOCTYPE, shoulf have an entry for string/menu and accelerator table.
If your working in a CDIaoog derived class I think you need to load the accelerator yourself and check to see whether it should be used yourself in an override of the PretranslateMessage using TranslateAccelerator fucntion.
If you vote me down, my score will only get lower
|
|
|
|
|
In the 16Bit days you could easily access the video ram B800:0000 with far pointers. "Far" is now obsolete since all pointers are 32Bit ones.
How can I access B800:0000 in a console application now ?
In 16Bit days this worked:
unsigned far int Videospeicher = 0xB8000000;
unsigned far int *pVideoPointer;
pVideoPointer = ( unsigned far int ) Videospeicher;
for( int i = 0; i < 20; i++)
{
*pVideoPointer++ = 0x4E41;
}
-- modified at 4:04 Friday 11th November, 2005
|
|
|
|
|
AFAIK, you can't. Windows is an OS with Virtual Memory support, which means that 0xB8000000 doesn't represent the physical memory at that address. What's more, if you try to read/write to that memory location, you'll get Access Violation errors because Windows detects that you're trying to use memory which has not been mapped.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Kamann wrote: In the 16Bit days you could easily access the video ram B800:0000 with far pointers.
One of my favorite parts of DOS programming was the ability to write directly to video memory.
Have you considered using the console API for this?
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
I wrote an entire UI library using direct video memory access. Exploding windows, SaveScreen/RestoreScreen, TextOut.. etc. Piece of cake and was it FAST!
onwards and upwards...
|
|
|
|
|
I want to hook the Calculator program anad want tok know which button is clicked. I tried to get the caption of button with GetWindowText function. it doesn't work for buttons. Also Spy++ Find Window utility does not find the captions of buttons, only it finds the class "Button".
why is it so? isnt there a way to know yhe caption of the button clicked?
please help me.
Elif (Erkul) Ceylan
|
|
|
|