Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs have moved to the Altera Community. Existing Intel Community members can sign in with their current credentials.

Using GETPROCADDRESS and EM64T

david-weinberg
Beginner
1,543 Views
I have an IVF application which uses GETPROCADDRESS get the address of a function within a DLL that has been loaded.

Q = GETPROCADDRESS( PCGSDLLP, "pcglssViaFuncs"C) where PCGSDLLP is the DLL pointer. This does not work in IVF 9 EM64T and gives a compiler error...

C:Version91Pcgs.for(66) : Error: There is no matching specific function for this generic function reference. [GETPROCADDRESS]

Does anyone know how to get around this? Is the problem that I am using the USE DFWIN and this is simply not been added for EM64T?

Message Edited by david-weinberg on 02-06-2006 01:09 AM

0 Kudos
6 Replies
Steven_L_Intel1
Employee
1,543 Views
My guess is that you have declared PCGSDLLP as INTEGER or INTEGER(4). It should instead be declared INTEGER(INT_PTR_KIND()), as pointers are 8 bytes on EM64T. Your using DFWIN is not the issue.
0 Kudos
Jugoslav_Dujic
Valued Contributor II
1,543 Views
Actually, it should be an INTEGER(HANDLE), and HANDLE should be 8 on 64-bit systems is it? Maybe he's got a wrong set of *.mod files USEd (i.e. wrong include path in 64-bit build environment).
0 Kudos
Steven_L_Intel1
Employee
1,543 Views
INTEGER(LPVOID) is more like it, but my earlier suggestion works too. Yes, the EM64T (and Itanium) modules have the correct types set up.
0 Kudos
Steven_L_Intel1
Employee
1,543 Views
Yes, INTEGER(HANDLE) would be correct. Q should be declared INTEGER(LPVOID). Yes, HANDLE gets the correct size on 64-bit platforms.
0 Kudos
david-weinberg
Beginner
1,543 Views

Thanks. The issue was that the compiler error given was not consistent with the problem as was throwing me off. I plan to use

INTEGER (KIND=INT_PTR_KIND()) PCGSDLLP

where PCGSDLLP is a pointer. Do you think this would be the best approach since the code would then be platform independent?

ALso, for C/C++ I have a similar issue...

Below is a routine that is used to return a pointer to a function for a call back...

double zpivot( void );
double (*zpivotPtr)( void );

int ZPIVOTGP( void )
{
zpivotPtr = zpivot;

return(zpivotPtr);

How could I in C make the int so when I compiled with IVC on EM64T it used the correct integer size? I know in the preferences in IVF I am keeping the default to int*4. Not sure how for the C code with the C compiler this would be handled. Namely I specify the size of everything in fortran but my C code does not (As I have shown above).
Thanks in advance!
0 Kudos
Steven_L_Intel1
Employee
1,543 Views
Using INTEGER(HANDLE) is no more or less platform-dependent than INTEGER(INT_PTR_KIND()) and has the same effect. Using HANDLE makes more sense as that's how the argument is declared in KERNEL32.F90.

In C, when you declare something as *foo, you automatically get the proper pointer size. Unlike Fortran, C has a pointer "type".
0 Kudos
Reply