4257467fec
1. header file and source file protections using #ifdef WIN32 2. new files and directories to support windows functionality 3. appropritate linkage symbols added (OMPI_DECLSPEC) for windows 4. some functions are unimplemented on the windows side. this is mostly because there might not be need to implement it in windows land. eg., forking a daemon off 5. Introduced locking mechanisms for windows This commit was SVN r3286.
37 строки
1.1 KiB
C
37 строки
1.1 KiB
C
/* Prabhanjan Kambadur: Open Systems Lab
|
|
Example documenting the usage of functions from a dynamic library in windows
|
|
September 24 2004 */
|
|
|
|
#include <stdio.h>
|
|
#include <windows.h>
|
|
#include "component.h"
|
|
|
|
void main(void)
|
|
{
|
|
HINSTANCE hinstLib;
|
|
struct component *component;
|
|
struct module *module;
|
|
|
|
/* Get a handle to the DLL */
|
|
|
|
hinstLib = LoadLibrary("component");
|
|
|
|
/* If the handle is valid, try to get the function address */
|
|
|
|
if (hinstLib != NULL) {
|
|
component = (struct component *) GetProcAddress(hinstLib,
|
|
"component_instance");
|
|
|
|
/* If the function address is valid, call the function */
|
|
|
|
if (NULL != component) {
|
|
module = component->component_query_fn(37);
|
|
module->module_query_fn(17);
|
|
} else {
|
|
printf("Was not able to find component_instance\n");
|
|
}
|
|
} else {
|
|
printf("Was not able to LoadLibrary\n");
|
|
}
|
|
}
|