Thread: Native call
View Single Post
  #5   Spotlight this post!  
Unread 18-12-2010, 11:04
byteit101's Avatar
byteit101 byteit101 is offline
WPILib maintainer (WPI)
AKA: Patrick Plenefisch
no team (The Cat Attack (Formerly))
Team Role: Programmer
 
Join Date: Jan 2009
Rookie Year: 2009
Location: Worcester
Posts: 699
byteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of light
Re: Native call

Quote:
Originally Posted by Greg McKaskle View Post
Just to keep the terminology clear, the C way is really defined by the OS or the library standards they have adopted. LV is making the same calls under the hood.
I was more refering to the C linking process. You build your code, and if a function's definition cannot be found, it remembers this, so that when it is on the cRIO, it links all the previous stubs to the actual location.
Quote:
Originally Posted by Greg McKaskle View Post
Here is the help for the dialog:

Library name or path—Specifies the library name or path for the function you are calling. Enter only the library name if the library is in the search path of the system. Enter the entire path if the library is not in the search path of the system. To make the reference platform independent, use the * wildcard. If you use the C++ compiler, the names of the functions in the library are altered by a process called name mangling and are platform dependent. When you use a C++ compiler, export functions with the extern "C"{} statement in your header file in order to prevent name mangling.


Are you using C++? Have you declared the entrypoints to be extern C? Does the Tip above possibly apply?
I am using extern "C" (ones that I call are in bold)
Code:
extern "C"
{
    void ZomBDashboardInit(ZomBModes mode, char* ip);
    int ZomBDashboardAdd(const char* name, const char* value);
    int ZomBDashboardAddDebugVariable(const char* name, const char* value);
    const char* ZomBDashboardGetString(const char* name);
    int ZomBDashboardGetInt(const char* name);
    float ZomBDashboardGetFloat(const char* name);
    double ZomBDashboardGetDouble(const char* name);
    int ZomBDashboardHasSpace();
    int ZomBDashboardIsConnected();
    int ZomBDashboardIsAnyConnected();
    int ZomBDashboardCanSend();
    int ZomBDashboardSend();
    void ZomBDashboardResetCounter();
}
Quote:
Originally Posted by Greg McKaskle View Post

Personally, I wouldn't use the path input. I'd use the static lib name in the dialog with a * suffix. If you use the path input, use a constant or runtime values could possibly unload the lib.

As I mentioned earlier, all of this is very OS dependent and I'm not sure about the VXWorks details. I'm not sure if dynamic loading and unloading work the same as on other platforms.

Feel free to post a picture of your diagram and one of the config dialog if that helps with the description.

Greg McKaskle
how about a zip of the ZomB stuff and Telop, Begin, and my out file?

I've also noticed (of my 3 c calls) the following:
void ZomBDashboardInit(ZomBModes mode, char* ip); //no library name needed
int ZomBDashboardAdd(const char* name, const char* value); //Library needed, does not give errors
int ZomBDashboardSend(); //library needed, gives errors
Attached Files
File Type: zip ZomB.zip (1.00 MB, 11 views)
__________________
Bubble Wrap: programmers rewards
Watchdog.Kill();
printf("Watchdog is Dead, Celebrate!");
How to make a self aware robot: while (∞) cout<<(sqrt(-∞)/-0);
Previously FRC 451 (The Cat Attack)
Now part of the class of 2016 at WPI & helping on WPILib
Reply With Quote