Showing results for 
Search instead for 
Did you mean: 
Showing results for 
Search instead for 
Did you mean: 

Looking for some pointers on the C API

Regular Member

Looking for some pointers on the C API

I would like to start looking into integrating the API into some software I'm working on. Basically I am hoping someone can help me with using the sample code at When I try to include mksapi.dll as a reference in my project, I get an error "A reference to 'mksapi.dll' could not be added." I don't have the Visual Studio integration setup but I was under the impression (maybe incorrectly) that this wouldn't be required. Has anyone encountered this before and found a solution?


Tags (3)

Accepted Solutions

Re: Looking for some pointers on the C API

The source of my problem was what I defined in the app capabilities. This is something unique to WIndows RT apps. I had the Internet (Client) capability selected but I did not have Private Networks (Client & Server)selected. Because of this my app could not talk to the Integrity server but because of my unfamiliarity with the API, I had trouble tracking down the issue.


Since Visual Studio 2013 Express isn't one of the versions supported for the Visual Studio Integration, I had to set it up a bit differently. Here's how:

  • Using 7zip, I extracted MKS.ManagedAPI.dll from the Integrity_VS_Integration.msi installer
  • I added MKS.ManagedAPI.dll as a reference to my project (Project > Add Reference > Browse)
  • I added the following dll's in my project as existing items (In Solution Explorer, Right click project >Add > Existing Item) because Visual Studio 2013 Express will not allow them to be added as references
    • apiblimp.dll
    • libeay32.dll
    • libxml2.dll
    • mksapi.dll
    • mksapi.lib
    • nspr4.dll
    • ssleay32.dll


  • For each of the dll's (and lib), set Copy to Output property to Copy if newer

I was then able to use the sample code at: The only edit that I had to make was to use APIFactory.CreateIntegrationPointinsted of APIFactory.CreateLocalIntegrationPoint since I am running this on a remote machine and not the server.

I haven't done too much yet so I don't know whether or not this is really a full integration. So far I have only used the sample code to get a reply. I am hopeful that this will be the correct solution though.

View solution in original post


Re: Looking for some pointers on the C API

Hello Nolin, We haven't recently had anything like that reported, and I have never run into that myself. Maybe someone else has run into something similar? Regards, Kael

Kind Regards,
Kael Lizak

Senior Technical Support Engineer
PTC Integrity Lifecycle Manager

Re: Looking for some pointers on the C API

Dependency Walker is telling me that the below dlls are not found (and mksapi.dll is dependent on them). I think this may be a Windows 8.1 thing. I'm trying to figure it out now.


Re: Looking for some pointers on the C API

It looks like instead of adding the dll as a reference, you are just supposed to include it as an existing item. The Visual Studio Integration looks like it may be quite a bit simpler so I think I may just go that route instead.

Re: Looking for some pointers on the C API

Apparently the Visual Studio Integration only works with old versions of Visual Studio. Is there any plan to update this?

Re: Looking for some pointers on the C API

Here is where I am at after trying for a while to get this to work. To get the reference into my project, I extracted MKS.ManagedAPI.dll from the msi for Visual Studio Integration. This is because it cannot be installed with my version which is Visual Studio Express 2013. I added it as a reference. None of the other dlls could be added as they would all cause problems when it tried to compile. They all seem to rely on dlls for Windows desktop applications. I then included a bunch of the dlls from the client folder (including mksapi.dll) in the project instead of adding them as references. I have been working off of the sample code at When I try to run the code, I get the below error when the cmd tries to execute at cr.Execute(cmd). Does anyone have any idea how to get around this issue? Is there any way to tell if I am even able to communicate with the server?

Source: MKS.ManagedAPI

Message: API communications error

Stack Trace:

at MKS.ManagedAPI.CmdRunner.RawExecute(Command cmd, ExecutionType execType)

at MKS.ManagedAPI.CmdRunner.Execute(Command cmd)

at MyApp.MyFunction()

One thing that may be relevant; I had to use APIFactory.CreateIntegrationPoint instead of CreateLocalIntegrationPoint because it would use instead of the correct server address. This allowed me to directly specify the server address.

Re: Looking for some pointers on the C API

Hi Nolin, please find mksapi.dll mksapi.lib mksapi64.lib under <integrity client installation path>\bin, then add them into your microsoft visual studio project as reference and dependency.

Re: Looking for some pointers on the C API

I have them all included by adding them with Right Click>Add>Existing Item but if I try to add mksapi.dll as a reference, I get the error in my original post.


Correction: I get this error when I try to add mksapi.dll as a reference


Re: Looking for some pointers on the C API

My previous reply was for C API.

For C# API, MKS.ManagedAPI.dll from Integrity Visual Studio Integration is what you need, but unfortunately Microsoft Visual Studio 2013 was NOT tested.

And when I say "add reference" it didn't mean add the files as "Exsiting Item", it means:

How to: Add or Remove References By Using the Add Reference Dialog Box

Above document is from Microsoft MSDN website

Re: Looking for some pointers on the C API

Normally "API communication error" means the application cannot talk to the Integrity server, there are two scenarios:

1. The PC running your application IS the Integrity server, then CreateLocalIntegrationPoint should be used

2. The Integrity server is somewhere else, then CreateIntegrationPoint should be used to give an IP address

Hope that helps.