|
Is it possible to load a dll multiple times in same process address space?
|
|
|
|
|
Derar RaviPK
Yes! It is possible! but you must detache dll then attache it.
It achive with "LoadLibrary" and "FreeLibrary"
|
|
|
|
|
Hi Coders,
I want to call a Visual Basic 6.0 dll in Visual C 2005.
Any Ideas ?
Thanks.
|
|
|
|
|
I am new in VC++. I found this article veryusefull. But when I tried to use to develop a dialog based DLL, I was unable to start the dialog from DLL. I developed a function in DLL which calls the DoModal() member of the derived dialog object but it returns with -1 i.e. dialog box is not created in Modal fashion. Can any body help me telling the way how to start a dialog in a DLL.
Regrads
|
|
|
|
|
could you explain the diffrence between *.dll and *.lib?
wavebai
|
|
|
|
|
Dear wavebai
1- .Lib files must be link to program then have compile but .Dll files have compile separatly and independence from .Exe files then load into Exe's on run time.
2- If .Lib have changed then exe must be recompile but If .Dll have changed it dont need recompiling exe.
3- Becuase .Lib link to exe thus programs have more size.
4- Several programs can use one Dll simultaneously
|
|
|
|
|
I am very grateful to get your reply and thank you very much.But I got another problem: if you creat a dll project ,after compilling,you will get a *.dll and a *.lib(1);what is the diffrence between them?if you create a static dll project,you get a *.lib(2) only,what is the diffrence between *.lib(1) and *.lib(2)?
wavebai
|
|
|
|
|
if you create a dll an import library will be created to...
this library only contains the info which methods etc. are
exported... it just helps the linker to get everything right.
a static library includes the whole code not just "links" to
a position in a dll.
i hope i could help you
|
|
|
|
|
How to export classes with virtual functions?
KIRAN PINJARLA
|
|
|
|
|
I'm getting error C2011: 'CRectArea' : 'class' type redefinition in the imports.h file! It's like this:
#define DLLIMPORT __declspec(dllimport)
class DLLIMPORT CRectArea
{
public:
int Calculate(int ParOne,int ParTwo);
CRectArea();
virtual ~CRectArea();
};
-- modified at 9:09 Thursday 10th August, 2006
And guess what! I'm copyed the class to the Apps header files top, and it's working!!! If I'm try to put it back to imports.h, than it give the same error!
|
|
|
|
|
Hi,
Using your article, I learned how to create a MFC dll. I passed a CString object and that works fine.When i tried to add a dialog, on run time, when the dialog was initiate, I got the following message "Run-Time Check Failure #2 - Stack around the variable 'dlg' was corrupted." since the dialog C'tor failed.
Do you have any clue, why did it happen to me ?
Thanks in advance, Udi Raz
|
|
|
|
|
can i import a DLL made by any other programme like MATLAB programme
|
|
|
|
|
You can import functions of all DLLs that SPY++ can analize it.
|
|
|
|
|
Sorry for posting that problem, but as I am not that fit in C++, I couldn´t resolve it. I tried the following implementation
void CImportTestDlg::OnCalculate()
{
double m_Result;
double m_ParOne;
double m_ParTwo;
CRectArea m_RectArea;
m_ParTwo=1.5;
m_ParOne=1.3;
UpdateData();
m_Result=m_RectArea.Calculate(m_ParOne,m_ParTwo);
CImportTestDlg.SetWindowText(m_Result);
UpdateData(FALSE);
}
The compiler says: error C2065: 'CRectArea' : undeclared identifier
but I followed all the others step (inclusion of .h file in the importTestDlg.cpp).
Any hint?
Thanks
|
|
|
|
|
Hi,
I have DLL file without any LIB file. However I have .opt file along with the DLL file.
So I guest, I have to link the DLL explicitly.
However, so far I only found how to load function in DLL not class.
Do you know a way to load class in DLL explicitly ???
Thanks.
|
|
|
|
|
The mentioned procedure does not work for template classes. Do you know any solution for making DLL or LIB from template base classes?
JAP
|
|
|
|
|
DLL or LIB contains instructions that processor can execute. Templates are just the parametrized source, they cannot be compiled to processor instructions directly.
|
|
|
|
|
Thanks for your reply.
Can I ask to tell me how I can make dll from a template class? I don't know what procedures I do for that.
JAP
|
|
|
|
|
The question is what do you mean to place in DLL: a template itself or its instantiation for some data type? If first, I guess you cannot do so (or you will just provide empty DLL with full template source in h/inl-file). If second, IMHO, a good approach may be to make a class wrapper around a instantiated template.
|
|
|
|
|
Suppose you have Base and Derived class, then how to export Derived class, is it necessary to export Base too ?
Sonork ID 100:25668 Home Page
|
|
|
|
|
Name Mangling
I understand that the major reason that classes aren't used in DLL is due to name mangiling between variosu compilers. Isn't this still true? In that case, the DLL that exports the class will only valid with other DLL's created withthe same compile/version.
Isn't this the reason that COM was developed? That is, to provide a protocol to pass objects through a functional interface.
|
|
|
|
|
Name mangling is definitely a problem when trying to import a class compiled under 'brand a' into 'brand b' - I've always just compiled multiple versions of the DLL - one under each compiler (which in itself is a great way to spend an afternoon)
Usually the only consumer for your 'class' DLL would be yourself, and the aim of the DLL is to extract some common functionality that you use between multiple applications you are developing. When I write a DLL that is to be used by 'other' people I always give them a plain 'extern "C"' type DLL - then all you need to worry about is underscores (_) between different brands of compiler.
I note that this example has TWO copies of the class definition - in itself that could be bad in that it means whenever the class changes BOTH copies need to be updated. There are easy ways to use the same .h file and have the compiler know whether to 'dllexport' or 'dllimport' it.
The major problem with exporting a class from a DLL is that as soon as you change the class definition, there's a good chance the DLL won't load anymore (function signatures have changed), and if it does, there is no guarantee it will work "as expected" if any member variables are directly accessed (i.e. not using setter/getter functions)
|
|
|
|
|
You have provided a valuable service here to both beginners and some others who may have had difficulty understanding how this particular use of a DLL service is done.
It's clear and it's easy. A '5' from me.
Thank you.
William
Fortes in fide et opere!
|
|
|
|
|
thanx
|
|
|
|
|
Very short and precise but, useful and helpful to understand. Thankx
Mr. Milind Murlidhar Shingade has Master of Engg. degree in Computer Science and Engg. from Indian Institute Of Science, Bangalore (Tata Institute) and has 4 years of application software development experience. He has specialized himself in developing software for process control system and integrated development environment. Currently he is working as Specialist at TATA Elxsi, Bangalore, India.
|
|
|
|