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:

C-Hook - Technical question


Recommended Posts

Hello,

 

I have a technical question for you guys that I hope you can answer for me.

I'm working to implement a mechanism that mix native and managed code, something like

C-Hook (C++) <-> Wrapper (C++) <-> Managed Library (C#).

The reason I'm doing that is because, basically the main part of the job is completed within a C# library.

First of all, I'm creating an interface to the C++ wrapper (IManagedCodeWrapper)

Then I create the class factory ManagedCodeWrapper : IManagedCodeWrapper that creates a static instance of the class itself and call

the desired method from the managed library.

 

All this stuff works well in my testing so far, however I can't make it turn out within Mastercam.

 

I don't know why Mastercam doesn't like the code snippet who creates the wrapper

code:

IManagedCodeWrapper *wrapper = IManagedCodeWrapper::CreateInstance()

Would someone be kind to have a look this please ...

Thanks a lot !

 

--Titus

Link to comment
Share on other sites

Hello,

 

When I'm trying to load the C-Hook, I'm getting the error message "Could not load file or assembly <...> or one of its dependencies. The module was expected to contain an assembly manifest."

 

After clicking on "Ok" again, another messagebox "The appropriate Mastercam .NET Support dll could not be found" is popping up

 

Commenting out that line of code afterwards everything goes well again...

 

Thanks a lot for your assistance!

 

--Titus

Link to comment
Share on other sites

I'm not able to reproduce the hang in my test environment because everything works wonderful.

 

All references are there. Now I'm using just a simple c# DLL that is popping up a "Hello" messagebox.

 

The wrapper is there as well. I don't see anything wrong with this...

 

Thanks !

Link to comment
Share on other sites

Hello guys,

 

Everything works like a charm now.

 

When you encounter an assembly loading problem,

consider using the Assembly Binding Log Viewer

tool that comes with the .NET Framework

(fuslogvw.exe) to determine which dependency

failed to load and why.

 

Here what I did:

- compile without /clr option (not sure if this could be a potential issue...)

- link with /fixed:no additional switch.

- put all other DLLs in my McamX2 directory (Thanks Roger to pointing this out !!! The DLLs was properly referenced but wasn't placed in the proper directory).

 

Thanks Roger again for answering !

 

--Titus

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...