@Andrew Lovatt wrote:
I'm trying to pass arrays to and from a LabVIEW generated DLL within a Borland Builder project.
Unfortunately as this link discusses Borland can't easily process LabVIEW.lib (OMF, COFF). I see what the correspondent has done for her case, but can't make this work for the DSNewHandle call which is required for array handling.
Borland uses the OMF format. Microsoft uses the COFF format.
The link libraries provide in the cintools directory are COFF for the labview.lib file and most probably OMF for the labview.sym.lib file which is really for Symantecs C compiler. However there is a good chance that Borland can't even work with the labview.sym.lib file eventhough it should be in OMF format as well. Basically each compiler manufacturer tends to create its own variant of object format eventhough they in principle base it on some general standard.
One way of using the LabVIEW internal manager functions from non supported compilers is to import those functions explicitedly by name. Basically the LabVIEW.exe file exports all those functions by name just as a DLL would. So you can write code like:
typedef UHandle (__cdecl *DSNewHandle_Ptr)(int32 size);
HANDLE ghLV = NULL;
DSNewHandle_Ptr pDSNewHandle = NULL;
UHandle DSNewHandle(int32 size)
{
if (!pDSNewHandle)
{
if (!ghLV)
ghLV = GetModuleHandle(NULL);
if (ghLV)
pDSNewHandle = GetProcAddress(ghLV, "DSNewHandle");
}
if (pDSNewHandle)
return pDSNewHandle(size);
else
return NULL;
}
Rolf Kalbermatter
Rolf Kalbermatter
My Blog 
DEMO, Electronic and Mechanical Support department, room 36.LB00.390