VB + C = pain.dll
Posted on 1997-06-15
I have a problem: I need to write a Windows DLL, in Borland C/C++ (v. 5.0 Win95 32-bit), and tweak it so that it can interface with Visual Basic (4.0 Professional Edition 32-bit). How do I
1). Pass arrays of integers (int, long, etc.) from VB into a function in the DLL ? If possible, I would prefer to pass them "by reference" - that is, the alterations that the C function makes in the array are reflected in the "original" array.
2). Pass arrays of user-defined types (structs, that is) from VB into a function in the C DLL (also "by reference", if possible) ?
3). Return strings from the C DLL into VB ?
4). Alter strings passed to the C DLL functions as parameters inside the DLL (from VB point of view, this is "passing strings by reference"), so that the changes do not go away when the function returns ?
5). Do all of these with dynamic memory allocation ?
Any help will be greatly appreciated... Thanks for reading this :-)