Chapter 4 Windows3.1 Compiler/Linker Issues
LabWindows/CVI Programmer Reference Manual 4-20
©
National Instruments Corporation
int g(struct x *ptr)
{int retval;
unsigned short cw387;
char *savedPointer;
savedPointer = ptr->name;
if (Alloc16BitAlias(ptr->name, ITEM_SIZE, &ptr->name) == -1)
return <
error code
>;
cw387 = Get387CW();
retval = (int) InvokeIndirectFunction(__static_g, ptr);
Set387CW(cw387);
Free16BitAlias(ptr->name, ITEM_SIZE);
ptr->name = savedPointer;
return retval;
}
DLL Exports Functions by Ordinal Value Only
If your DLL does not export its functions by name, but by ordinal number only, you must
modify the GetProcAddress function calls in the glue code. Instead of passing th e name of
the function as the second parameter, pass PASS_WORD_AS_POINTER(
OrdinalNumber
),
where
OrdinalNumber
is the ordinal number for the function. For example, if the ordinal
number for the function InstallCallback is 5, change the glue code as follows.
Generated Glue Code:
if (!(fp = GetProcAddress(DLLHandle,"InstallCallback")))
{funcname = "_InstallCallback";
goto FunctionNotFoundError;
}
Change to:
if (!(fp = GetProcAddress(DLLHandle, PASS_WORD_AS_POINTER(5))))
{funcname = "_InstallCallback";
goto FunctionNotFoundError;
}
00ProRef.book : 06chap04.fm Page 20 Monday, March 9, 1998 3:23 PM