Recently came up on this road block. My coworker created a C++ DLL using Gcc/G++ compiler. In order to use the DLL in my Ranorex project I had to do the following:
1) Target the Ranorex project to the correct Target CPU that the DLL was also targeted to. For me I had to change the Target CPU to 64 bit under the "Compiling" tab of the project properties
2)Add using System.Runtime.InteropServices; to the code module you will be using
3)Add the following attribute to your code module class:
[DllImport(@"C:\API_Tester\API_Tester\bin\Debug\RBTASl.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern void setup( [In] string cmd, [Out] char [] result);
Notice the [In]/[Out] attributes in the arguments signifying if they are input or output variables.
here's a good resource for parameter passing: https://manski.net/2012/06/pinvoke-tuto ... rs-part-3/
Hope that helps someone else!
Using external C++ DLL's in Ranorex (non .net dll)
-
- Posts: 20
- Joined: Tue Nov 06, 2018 9:14 pm
Re: Using external C++ DLL's in Ranorex (non .net dll)
Hi Bassem.Ibrahim!
This is really good information. Thank you for sharing with the community!
--Jacob
This is really good information. Thank you for sharing with the community!
--Jacob