LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How to program a pure 64-bit application with cvi 2009?

Hello,

 

I am confused by the menu options, from the menu of Build>>Configuration, it can specify the X64 option that seems it can generate a 64-bit program, but from the menu of Options>>Build options..., the default call convention not has the option of __fastcall. I am not sure if just specify the Build>>Configuration to X64, that the generating code is a pure 64-bit?

 

 

David

0 Kudos
Message 1 of 10
(4,358 Views)

Hi David,

 

Seems just change build configurations could work. Please check "Creating 64-bit Applications Versus 32-Bit Applications" in CVI help, it says by selecting build configuration could generate a 64-bit application.

 

Xiaojian Wang

0 Kudos
Message 2 of 10
(4,336 Views)

Hi, Wang,

 

But what is the role that the menu of "Options>>Build Options..."?

Another question, As to CVI 2009 help doc, the "Porting 32-bit code to 64-bit code", it shows if programming 64-bit code, e.g., state the integer, it should use the specifier "ssize_t" instead of using "int", but why the call back function still use "int" to state its returns?

 

 

David

0 Kudos
Message 3 of 10
(4,325 Views)

David,

 

The calling convention setting in the Build Options dialog only applies to 32-bit builds. That's why it has "(32-bit)" in the name. The reason __fastcall isn't shown in the Build Options dialog is because there is nothing to choose -- that is the only calling convention that can be used with 64-bit builds.

 

As for size_t (and ssize_t), I think you might be misunderstanding that portion of the help topic. You do not have to (nor should you) change all your integers to size_t. As Wolfgang mentioned earlier, you should only change the types of integers which might hold 64-bit values in the 64-bit version of your application. The return value of a callback is not an example of something that would ever hold a 64-bit value, so it was not changed to size_t.

 

Luis

0 Kudos
Message 4 of 10
(4,305 Views)

Think you LuisG, as your explanation, I understand somewhat. I also ask another question: if programming a dll code with cvi 2009, should it state explicit the qualifier __fastcall" ?

 

 

 

David

0 Kudos
Message 5 of 10
(4,289 Views)

Within CVI, it's unnecessary, since __fastcall is already assumed for any functions compiled in 64-bit.

 

However, since this is a dll, if there's any chance that this dll will be used by programs built with a different compiler, it's probably a good idea to include it. It's always a good idea to state the calling convention explicitly when creating dlls.

 

If you do include it, make sure to include it both in the function definition (.c file) and in the declaration (.h file).

 

Luis

0 Kudos
Message 6 of 10
(4,261 Views)

Hi Luis,

 

Thank you for the reply. In fact, there are a lot of 32-bit dlls would to be called in the 64-bit applications, due to I can not acquire the source code, means can not recompile them, is there any way to call the 32-bit dll in a 64-bit program?

 

 

David

0 Kudos
Message 7 of 10
(4,238 Views)

As far as I am aware, there is no mechanism in Windows to call a 32-bit DLL from a 64-bit application.

--
Martin
Certified CVI Developer
0 Kudos
Message 8 of 10
(4,215 Views)

That's correct, you cannot load a 32-bit DLL onto a 64-bit process, or vice-versa. If you're stuck with 32-bit DLLs that you cannot recompile, then you will have to create a second process, that can be 32-bit, which will load these DLLs for you. And you'll then have to set up some communication mechanism (TCP, etc...) between the two processes.

 

Luis

0 Kudos
Message 9 of 10
(4,207 Views)

Hi Luis,

 

Thank you for your advise. 

 

David

 

 

0 Kudos
Message 10 of 10
(4,187 Views)