I wrestled with this one for awhile, but discovered (via Google) that you can use StringBuilder to allocate a fixed-length string, then pass the StringBuilder in by value to the exported function/method in the unmanaged DLL. Strings don't work in this case because they are not fixed length, and access violation errors can (and usually) occur.
Declare Ansi Function Function_Name Lib "lib.dll" (ByVal strGoingIn As String, ByVal strComingOut As StringBuilder) As Integer
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment