- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
i'm using cvf 6.6b. i am trying to make my application such that a user can had their own .dll function calls. to do this, i'd like to have a single .dll file that the user would always have, such as "some_dll.dll". i wrote a simple .dll in C and in fortran. In C, the prototype is as such:
extern "C" long __stdcall TEST_FUNCT(float TESTIN1, double TESTIN2, short TESTIN3, long TESTIN4, float *TESTOUT1, double *TESTOUT2, short *TESTOUT3, long *TESTOUT4)
In fortran, i need to specify this as _TEST_FUNCT@36... what? @36? yes, that's right... apparently the function type is long, so that adds another 4. however, if i do this function in fortran, the alias would be _TEST_FUNCT@32. obviously these conflict and i wouldn't be able to make a common call for both because one is @36 and the other is @32. is there a way around this?
one thing that is interesting is that VB will work as i want. if i have a fortran or C .dll, it can use the same function prototype and doesn't care if it is a C or fortran .dll, it runs perfectly. Can fortran be this forgiving?
related to this topic - is there a way to make a .dll call in fortran with OUT having to include a .lib file? ie, let's say the user wants to call a system api and they have just a .dll, how would they use this?
extern "C" long __stdcall TEST_FUNCT(float TESTIN1, double TESTIN2, short TESTIN3, long TESTIN4, float *TESTOUT1, double *TESTOUT2, short *TESTOUT3, long *TESTOUT4)
In fortran, i need to specify this as _TEST_FUNCT@36... what? @36? yes, that's right... apparently the function type is long, so that adds another 4. however, if i do this function in fortran, the alias would be _TEST_FUNCT@32. obviously these conflict and i wouldn't be able to make a common call for both because one is @36 and the other is @32. is there a way around this?
one thing that is interesting is that VB will work as i want. if i have a fortran or C .dll, it can use the same function prototype and doesn't care if it is a C or fortran .dll, it runs perfectly. Can fortran be this forgiving?
related to this topic - is there a way to make a .dll call in fortran with OUT having to include a .lib file? ie, let's say the user wants to call a system api and they have just a .dll, how would they use this?
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
What adds these 4 bytes is not the return value -- the culprit is TESTIN2, which is a double passed by value. On IA32, sizeof(long) == sizeof(int) == 4. But that's not what you want anyway -- Fortran arguments are always passed by reference (unless one plays with !DEC$ATTRIBUTES on Fortran side) regardless of their INTENT -- so, you need float& [const] TESTIN1, double& TESTIN2 etc.
VB has changed behaviour in this regard accross versions. IIRC, since VB6, everything is ByRef (as in Fortran) unless you specify ByVal explicitly.
related to this topic - is there a way to make a .dll call in fortran with OUT having to include a .lib file? ie, let's say the user wants to call a system api and they have just a .dll, how would they use this?
Yes. The keywords are LoadLibrary and GetProcAddress APIs(also require CVF Cray pointer extension). This has been discussed many times here so I wouldn't repeat -- please search the Forum. See also LOADEXP1 CVF sample, or MAPI sample on my home page.
Jugoslav
VB has changed behaviour in this regard accross versions. IIRC, since VB6, everything is ByRef (as in Fortran) unless you specify ByVal explicitly.
related to this topic - is there a way to make a .dll call in fortran with OUT having to include a .lib file? ie, let's say the user wants to call a system api and they have just a .dll, how would they use this?
Yes. The keywords are LoadLibrary and GetProcAddress APIs(also require CVF Cray pointer extension). This has been discussed many times here so I wouldn't repeat -- please search the Forum. See also LOADEXP1 CVF sample, or MAPI sample on my home page.
Jugoslav
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page