2

We have unmanaged 32bit c++ dll and we want to wrap it in COM code which is 64bit and written in VB.net. The unmanaged dll method has parameter with pointer datatype and we are not able to fetch required response from the methods. Also, code behind the dll is unknown

We have tried different types of datatypes in VB to match with C++ pointer datatype: WE tried - BYTE(), String, long, arraylist, intptr, uintptr, progress.open4GL.memptr, byte, integer etc..

This is how we import dll and parameters are (input string,input_output ptr,input_output ptr) and the return type is long. Issue is with ptr variables

<DllImport("wp2.dll")>
Public Shared Function WPStartJob(<MarshalAs(UnmanagedType.LPWStr)> typAvlista As String,
                                  ByRef mPVariabelLista As IntPtr,
                                  ByRef mPSubrapportLista As IntPtr) As Long
End Function

output of the method(for argument with pointer type) should be list of string values ex. "ListaS_Sub.rpt"

But we are getting null value with all types tried.

  • See here https://stackoverflow.com/q/128445/82560 , I don't think you can access a 32-bit dll if you are compiling your application as 64-bit. – tcarvin Oct 11 '19 at 13:14
  • I am able to access the dll with "" .Even response is fectched for few of the methods inside the dll. Issue is only with methods, which do has pointer parameters. Response from those methods are not as expected. – Nayana Ravi Oct 16 '19 at 05:34
  • Do you have documentation, samples, and/or header files for the C++ library? – tcarvin Oct 16 '19 at 12:33
  • No , we do not have header files for that C++ dll. We just have one .inp files(written in progress 4gl) from which we got the method signature. ex below :procedure WPStartJob external "wp2.dll": define input parameter Mall as character. define input-output parameter VariableList as MemPtr. define input-output parameter SubreportList as MemPtr. define return parameter Msg as Long. end. – Nayana Ravi Oct 17 '19 at 06:42
  • You need more to go on then that. How do you even know `VariableList` and `SubreportList`are strings? They could be structures. APIs often have you pass in your own memory and copy to it, so you need to know what to allocate for `VariableList` and `SubreportList`. – tcarvin Oct 17 '19 at 12:42

0 Answers0