- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am in the process of migrating from CVF to IVF 8.0. DLL's that I wrote in CVF have problems when called from VBAafter I recompile in IVF. VBA complains about bad calling conventions. So I set the !dec$ attributes toSTDCALL andREFERENCE with no luck. Once I set the/iface to CVF via Project Properties and removed the STDCALL, REFERENCE attributes everything worked just fine.
My question: what is the difference between CVF and STDCALL, REFERENCE? Doesn't VBA use STDCALL as its calling convention and parameter passing by references?
Thanks.
Link Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
"CVF" implies ALL the defaults of CVF - STDCALL, pass by reference, uppercase names, string lengths mixed. If you say just STDCALL, you get pass by value and lowercase names (and string lengths at the end.)
Yes, you should use STDCALL (with appropriate modifiers) with VBA. I suggest avoiding the "CVF" switch - some bugs give it unwanted side effects.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Steve,
Thanks. I was able to create a DLL using !dec$ attributes stdcall,reference compiler directives and setting uppercase names and mixed string length arguments in the Project Properties box.
The documentation says that if stdcall and reference are set via a !dec$ directive for a routine, then mixed string length arguments are implicit so long as noargument is set to reference individually and on W32 systems, names are uppercase. Is this correct? Or alternately is there any way to set uppercase names and mixed string length arguments via a !dec$ directive?
I also have another question about what will happen if I set a !dec$ stdcall but the Project Properties areset to __cdecl? Does the !dec$ directive supersede the Project Properties selection or the other way araound?
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It says that mixed string lengths are implicit? That's wrong.
Directives always override compile options/project properties.
If you explicitly say STDCALL in a directive, names are lowercased. Unless you say REFERENCE, arguments are passed by value. The location of the string length is not changed. (There's the [NO]MIXED_STR_LEN_ARG attribute for that.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Steve,
I have misstated that mixed length arguments are implicit. Here's an excerpt from the Intel Fortran Language Reference (14-12).
"If C or STDCALL is specified, and REFERENCE is specified for the routine (but REFERENCE is not specified for the argument, if any):
On all systems, the string is passed with the length"
But that's not the same implicit, so mea culpa. Thanks.

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