Answered by:
using functions from a c+ DLL in vb.net

Question
-
Hi
I have a c+ DLL with various functions (don't have source for it, it is a commercial DLL/SDK)
I have to access the functions via the ordinal i.e. 429 rather than by name
How do I use it in my code - I have never had a DLL like this which is "unmanaged?", used COM before so can add it as reference etc - so am lost how to use this one
Sorry if vague but it is a commercial DLL/SDK I am trialling, and the company only works with C++ so can't help me - hence why I haven't mentioned name of DLL
Thanks
Darren Rose
Friday, April 10, 2015 10:56 PM
Answers
-
- Proposed as answer by IronRazerz Friday, April 10, 2015 11:49 PM
- Marked as answer by Youjun Tang Wednesday, April 22, 2015 9:43 AM
Friday, April 10, 2015 11:18 PM -
You can use the DllImportAttribute Class and set the DllImportAttribute.EntryPoint Field or use the Declare Statement to expose the unmanaged C++ functions in your application.
Here are a few other links you may want to look through too.
Using P/Invoke to Call Unmanaged APIs from Your Managed Classes
Walkthrough: Calling Windows APIs (Visual Basic)
If you need to know which managed data types to use for the unmanaged data types in the signatures you can look at this link to see the type to use.
Marshaling Data with Platform Invoke
If you say it can`t be done then i`ll try it
- Edited by IronRazerz Saturday, April 11, 2015 12:02 AM
- Marked as answer by Youjun Tang Wednesday, April 22, 2015 9:42 AM
Friday, April 10, 2015 11:49 PM
All replies
-
- Proposed as answer by IronRazerz Friday, April 10, 2015 11:49 PM
- Marked as answer by Youjun Tang Wednesday, April 22, 2015 9:43 AM
Friday, April 10, 2015 11:18 PM -
You can use the DllImportAttribute Class and set the DllImportAttribute.EntryPoint Field or use the Declare Statement to expose the unmanaged C++ functions in your application.
Here are a few other links you may want to look through too.
Using P/Invoke to Call Unmanaged APIs from Your Managed Classes
Walkthrough: Calling Windows APIs (Visual Basic)
If you need to know which managed data types to use for the unmanaged data types in the signatures you can look at this link to see the type to use.
Marshaling Data with Platform Invoke
If you say it can`t be done then i`ll try it
- Edited by IronRazerz Saturday, April 11, 2015 12:02 AM
- Marked as answer by Youjun Tang Wednesday, April 22, 2015 9:42 AM
Friday, April 10, 2015 11:49 PM -
Thanks for your replies- will have a read through and see if I can get my head around this
Darren Rose
Saturday, April 11, 2015 12:27 PM