Jump to content

Welcome to eMastercam

Register now to participate in the forums, access the download area, buy Mastercam training materials, post processors and more. This message will be removed once you have signed in.

Use your display name or email address to sign in:

X C-Hook Question


Recommended Posts

I'm updating one of my v9.x C-Hooks for X and have run into a problem.

 

I need to get a list of Lathe tools in the current file and back in v9.x, I did so like this:

 

code:

void *pVoidLtl = NULL;

tl_list *pLtl = NULL, *pCurLtl;

char szLibName[255] ="";

 

 

// Get the linked list of tools.

list_manager(LTL_ID, szLibName, LSTMGR_GET, &pVoidLtl);

 

// Get the head of the list.

pLtl = (ltl_list *)pVoidLtl;

 

// As long as the list isn't empty, iterate

// through each tool in the list and do

// some super kewl stuff.

if (pLtl != NULL)

{

// Set the current pointer to the head of the

// tool list.

pCurLtl = pLtl;

 

// Iterate through the list of tools.

while (pCurLtl != NULL)

{

// do some super kewl stuff

// do more super kewl stuff

 

// get next tool

pCurLtl = pCurLtl->next_ptr;

}

}

 

// free up the allocated linked list

list_manager(LTL_ID, szLibName, LSTMGR_FREE, &pVoidLtl);

This code compiles fine for X but it doesn't build. The linker hates list_manager() and returns a 2019 error (unresolved external symbol). I've tried using different ids (TL_ID instead of LTL_ID) and casting the list pointer earlier:

 

code:

list_manager(TL_ID, szLibName, LSTMGR_GET, (void**)&pLtl);

But the result is the same.

 

Any suggestions? confused.gif

Link to comment
Share on other sites

Bullines,

 

That sort of error almost always comes up when building a new chook. It's because you aren't linking properly to the .lib files (as Steve is pointing out). You've probably forgotten one.

Assuming that you're using Visual Studio, you need to also remember to include the debug and release versions of the libs, and to exclude them from the opposite builds (ie. release from debug and vice versa).

Had this happen to me a few times.

 

Jon

Link to comment
Share on other sites

Steve and Jon (and Bob, who was absent in this thread but was there via email and phone),

 

Big-time thanks cheers.gif

 

I was linking to mastercam.lib and mccore.lib but not mcmill.lib. I guess I was lazy and thought the C-Hook Wizard would take care of it all (I must've flew through that dialog). I'm continuously noticing how much the SDK has changed from previous versions wink.gif

 

Now the joy of testing begins... tongue.gif

Link to comment
Share on other sites

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.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.

Join us!

eMastercam - your online source for all things Mastercam.

Together, we are the strongest Mastercam community on the web with over 56,000 members, and our online store offers a wide selection of training materials for all applications and skill levels.

Follow us

×
×
  • Create New...