Discussion:
How to call a class' static function in DLL?
(too old to reply)
Mark Junge
2004-04-18 16:33:48 UTC
Permalink
I hope I can help you with your second Question:

typedef int TinitXcl(void);

int initXcl(void);

HINSTANCE xlsLibrary;

void startfunction()

{

xlsLibrary = LoadLibrary("XCL.dll");

if (xlsLibrary != NULL) {

TinitXcl* initXcl; //Variable des Zeigertyps.

initXcl = (TinitXcl*) GetProcAddress(xlsLibrary,
"?initXcl@@YAHXZ");

if (initXcl != NULL) {

initXcl();

}

}

}

This sample shows how to start the function "initXcl()" in the dll "XCL.dll"
The Name of the Function for getprocaddress is in a .def file.

Greetz

Mark
Hi, all.
First, the class in the DLL is not exposed. Only a static function of the
class is exposed.
I think the static function of a class is as same as global function. Am i
right?
Second, I want to link the DLL dynamicly. As you know, Loadlibrary() and
GetProcAddress() will be called.
I have no idea how to do that. Does anyone know?
Thanks
Frank
Frank Wang
2004-04-23 07:29:33 UTC
Permalink
That's greate!!!
Thanks.
Post by Mark Junge
typedef int TinitXcl(void);
int initXcl(void);
HINSTANCE xlsLibrary;
void startfunction()
{
xlsLibrary = LoadLibrary("XCL.dll");
if (xlsLibrary != NULL) {
TinitXcl* initXcl; //Variable des Zeigertyps.
initXcl = (TinitXcl*) GetProcAddress(xlsLibrary,
if (initXcl != NULL) {
initXcl();
}
}
}
This sample shows how to start the function "initXcl()" in the dll "XCL.dll"
The Name of the Function for getprocaddress is in a .def file.
Greetz
Mark
Hi, all.
First, the class in the DLL is not exposed. Only a static function of the
class is exposed.
I think the static function of a class is as same as global function. Am i
right?
Second, I want to link the DLL dynamicly. As you know, Loadlibrary() and
GetProcAddress() will be called.
I have no idea how to do that. Does anyone know?
Thanks
Frank
Loading...