none
Using third party API (written in C) from dotnet RRS feed

  • Question

  •  Hi,

    I am making an small application in VB dotnet,which uses an ANSI C API provided by third party.I have the dlls, header files and .lib files of the API.I am trying to access these dlls using DllImport in my code.Do we have any other simpler method of referencing these dlls?
    Now I come to my main question.I think I am able to access the dlls using DllImport as DLLNotFound Exception is not thrown and I can also call the functions within the dll.The problem is that either the function do ot return anything or an exception is thrown.The problem lies with data types.Can you please tell me how can I match the different datatypes and enumerated types used in API with my VB.Net code.

    I need the solution urgently.Any help will be highly appreciated.

    Thanks a lot in advance...
    Sunday, August 3, 2008 7:43 PM

Answers

  • MS Learning said:

     Hi,

    I am making an small application in VB dotnet,which uses an ANSI C API provided by third party.I have the dlls, header files and .lib files of the API.I am trying to access these dlls using DllImport in my code.Do we have any other simpler method of referencing these dlls?

    I don't think so, not in vb.net at least. It is easier in c++/CLI with IJW ("it just works") where you can just include the header files.


    Now I come to my main question.I think I am able to access the dlls using DllImport as DLLNotFound Exception is not thrown and I can also call the functions within the dll.The problem is that either the function do ot return anything or an exception is thrown.The problem lies with data types.Can you please tell me how can I match the different datatypes and enumerated types used in API with my VB.Net code.

    You might be more likely to recive useful comments if you post your C API and how you try to import them. 
    Ben | bschwehn.de
    • Marked as answer by Zhi-Xin Ye Friday, August 8, 2008 10:00 AM
    Monday, August 4, 2008 11:01 AM