Question

I am attempting to connect to a commercial server application, which only has a C# API.

I would imagine that the best approach for doing so would be to create a C# DLL - which is what I have done. However, when examining the methods contained within the DLL utilising 3rd party tools, the methods do not seem to be visible.

I have searched extensively on StackOverflow, and found that the following suggestion works for most people - however the methods are still not visible when utilising this extension.

Thus it may be time to seek an alternate approach to how this problem can be solved - one option could be a C# console application.

Any ideas regarding what would be the best approach?

EDIT:

After running the DUMPBIN program, this is the output:

C:\Program Files (x86)\Microsoft Visual Studio 11.0>dumpbin /EXPORTS "C:\Users\mark\Desktop\Test.dll"

Dump of file C:\Users\mark\Desktop\Test.dll

File Type: DLL

  Summary

        2000 .reloc
        2000 .rsrc
        2000 .text
Was it helpful?

Solution

If the Basic+ has an option to call C code, you have an option to create a project in Managed C++:

enter image description here

Exports some function decorated like:

    extern "C"{
    __declspec(dllexport) void _cdecl MyFunction()
     {
          _MyImpl(); //see below wy this
      }
    }

void MyImpl()
{
    MyCSharpObj^ test = gcnew MyCSharpObj()...
    test->Methods(...
}

Outside of the portion decorated with extern C you can safely call and mix managed and unmanaged calls. The reason you should go outside the extern C block is that almost all managed function have overloads, and Extern C does not support method overloading even in call. You can call c# by just adding references ( actually you can write all your code in managed C++, but is not so friendly ) to your .NET libraries.

OTHER TIPS

Basic+ seems to be made by Revelation Software.

On this page, it says:

OpenInsight 9.1 released

This new OpenInsight release included a couple of .NET innovations. NetOI enables developers to code using their Microsoft Visual Studio licenses and work against an OpenInsight database. The RevDotNet functionality provides a method of calling .NET APIs and using the .NET controls within an OpenInsight application.

Can you use RevDotNet to call your C# APIs directly?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top