Jump to content

simple dll trouble


Recommended Posts

Hello,

I'm trying to write a dll for use in LabVIEW.

So I make this simple little dll source:

#include "lvdll.h"__declspec(dllexport) int AddInts(int x, int y) {	int z;	z = x+y;	return(z);}

It compiles fine (using OpenWatcom compiler) and I write a little test C app and it works correctly when called from there.

However, in LabVIEW, I use the call library function node, using C calling convention and wire up i32s to the parameters, I always get 1244517 as the result.

If anyone has any idea what could be going on, I would appreciate the help. This is starting to drive me nuts. :blink:

Thanks a lot,

Jon

Link to comment

First of all, what are your inputs?

Second, how did you define the inputs in the CLF node? It doesn't matter what you wire into it, because it will only be coerced into the data type you defined. I think int should be "signed 32 bit integer". Have a look at the VI in Examples\DLL\Data Passing for more examples.

Link to comment

My inputs are LV I32 controls. For the library function node, I'm using Signed 32 bit Integers. I've attached my little vi.

I have also tried using the example method of returning void in the dll and using a pointer to an integer to get the data out, but that didn't work either.

I'm wondering if it is a compiler issue (or maybe I'm exporting the function incorrectly or something), as I have called win32 dlls with no problems.

Anyway, thanks for your help,

Jon

Download File:post-1931-1140114472.vi

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.