The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 Forum for Origin C
 Ampersand in Origin C
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

peter.cook

UK
356 Posts

Posted - 01/28/2004 :  2:39:13 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hi,

Can someone please enlighten me as to the purpose/function of the ampersand prefixing variables required in eg lt_get_var.

Cheers,

Pete

cpyang

USA
1406 Posts

Posted - 01/28/2004 :  11:16:00 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
That was because LT_get_var was prototyped as

LT_get_var(LPCSTR lpcszLabTalkVarName, double * lpdbResult);

so a pointer must be used to call this function.

Many other functions in Origin C use reference passing so that you don't need to use &myVal etc. Functions like LT_get_var are external functions in a DLL. When calling external functions, C calling must be used, and passing by reference is not supported in C, it is rather a C++ feature.


CP


Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000