Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Help with x64: fatal error LNK1112: module machine type 'X86' conflicts with target machine type 'x64'

Hello, I am trying to complie some C code for some applications I am working on in labview (I am using Labview 2012 64bit).

When I try to build my code in Visual C++ 2010 ( I have set it up to be able to use x64) I get the following fatal error:

 

nivision.lib(StartupShutdown.obj) : fatal error LNK1112: module machine type 'X86' conflicts with target machine type 'x64'

 

Which I understand that .lib does not have a 64bit compatability. However, if I were to use 32bit code, how can I link/emulate it to my 64bit labview? Is there a good tutorial on this application? The problem is the rest of my application uses and requires 64bit labview, so I am stuck in this enviroment.

 

Thanks.

0 Kudos
Message 1 of 7
(7,357 Views)

Hi,

 

The problem is that you are linking a 32-bit import library (.lib) for the Vision Development Module into a 64-bit executable. Unfortunately, as you also noted, currently there is no 64-bit C capability in Vision Developent Module, so there is no 64-bit import library available.

 

Due to how LabVIEW works in that it compiles the VIs into native machine code, it is subject to the same limitations as you'd see in a standard C/C++ application, where all the DLLs loaded by a process (either 32-bit or 64-bit) must have the same bitness as the process. Thus, 64-bit LabVIEW can only load 64-bit DLLs.

 

Unfortunately I do not currently have any details on when VDM will natively support its C API in 64-bit mode. This would obviously be the ideal solution for you as it would "just work".

 

Some possible alternative solutions you might be able to pursue:

- Switch to 32-bit LabVIEW for your Vision application (this can run side-by-side with 64-bit LabVIEW and you could use shared variables or other mechanisms to communicate with the rest of your application)

- Remove your dependency on Vision Development Module (VDM) in your DLL. It is not clear what functionality you are using from VDM. Presumably you are writing your own low-level algorithm (or else I would assume you would just use the LabVIEW VDM functions rather than C) and so maybe you don't even need this dependency

- If you are using VDM functions, switch over your code to native LabVIEW rather than a C DLL. VDM is well supported in 64-bit LabVIEW, just not C.

 

Eric

0 Kudos
Message 2 of 7
(7,347 Views)

Thanks for the reply. The C code I have cross correlates images, and it does reference the image inputs and size variables from the nivision classes. I am thinking of using a side by side labview environment with shared variables. I have not done this before, do you have any good examples? Can you make the library function node a shared variable or only the elements within it? 

 

I guess I could try to convert to labview, but the are a lot of lines of code that I would prefer not to try to wrap my head around in translation.

 

 

0 Kudos
Message 3 of 7
(7,328 Views)

@dbrittain wrote:

Thanks for the reply. The C code I have cross correlates images, and it does reference the image inputs and size variables from the nivision classes. I am thinking of using a side by side labview environment with shared variables. I have not done this before, do you have any good examples? Can you make the library function node a shared variable or only the elements within it? 

 

I guess I could try to convert to labview, but the are a lot of lines of code that I would prefer not to try to wrap my head around in translation.


The LabVIEW API in Vision Development Module has functions that let you get access to all those parameters as well as the raw image data pointer. A common design is to query those items on the LabVIEW diagram and then pass them to your DLL. This would mean you wouldn't need to make any calls into the Vision DLL from your C code.

 

As for examples showing how to use shared variables, keep in mind that it isn't just like doing a function call. The more appropriate way to think of it would be communicating with another VI by getting and setting controls and indicators while it runs. You could put all your arguments into a shared variable and set a boolean indicating it is ready, then wait for another boolean to go high indicating the other code has finished and placed its results in another shared variable. Your application code interacts with the shared variables just like a control/indicator/local variable. This of course is a simple description and I would not be surprised if there are well-defined frameworks/examples searchable in the forums that use shared variables in this manner.

 

Eric

 

Eric

Message 4 of 7
(7,316 Views)

Thanks BlueCheese,I will look into shared variables with boolean states. If you know of any good examples it would be of great help. I will search the forums for some. 

0 Kudos
Message 5 of 7
(7,306 Views)

I can also post some code if one could send me some suggestions on how to setup shared variables between 32bit labview and 64 bit labview.

0 Kudos
Message 6 of 7
(7,287 Views)

Update, 

 

I have created two vis, one is the server vi and the other is the 'client'. They are both in separate projects and in addition the server project (containing the rest of my vi's for my application) is running in 64bit labview while the client with the .dlls is in 32bit labview. I have image data read into the server vi then they are bound to a cluster (which is set as a shared variable). The client vi has the shared variables linked to the PSP shared variables from the server side. 

 

All of this is fine, however I am getting a few errors. It seems that sometimes I get a generic error 42, which provides no real explanation. I also get error -1950679035 (0x8BBB0005), which states the variable has failed. When I probe my cluster at the server side, it does contain information, images and arrays. When the client pulls the data, I get the error. I have even tried to separate the cluster into many variables, and I get the error mainly with arrays and arrays of images. 

 

The problem therefore is that either a). The data being sent with shared variables is not compatible or sendable over the network b). The shared variable environment is not working (I made sure all firewalls etc are down and the the variables are deployed, which they are) with my application somehow. I can post a screenshot tomorrow if need be. 

 

Thanks

0 Kudos
Message 7 of 7
(7,250 Views)