I understand that it is possible to use CIN functions within a Win32 DLL. I have managed to get to the point where I don't know what is going wrong. I have "labview.lib" being linked correctly and there are no other compliation errors. The problem is a linking error as follows:
---------------------------------------
Linking...
Creating library Debug/cwst.lib and object Debug/cwst.exp
cluster_with_string_test.obj : error LNK2001: unresolved external symbol _DSSetHandleSizeOrNewHandle
c:\LV Dev\bin\cwst.dll : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
cwst.dll - 2 error(s), 0 warning(s)
---------------------------------------
The code is this:
// -----------------------------
-------
#include "extcode.h"
__declspec(dllexport) long create_handle(LStrHandle out);
__declspec(dllexport) long create_handle(LStrHandle out)
{
MgErr err = DSSetHandleSizeOrNewHandle(out, 7);
MoveBlock("you win", out, 7);
return (err);
}
// ------------------------------------
I'm guessing there's something missing in my setup so here's what I've noted as being the important changes to the default project settings that I have done. I am running Microsoft Visual C++ 6.0sp5, Enterprise edition:
In Project->Settings..
- C/C++ Tab:
- Set "Additional include directories", under the "Preprocessor" option, to the cintools directory (absolute path).
- Set "Struct member alignment" to "1 Byte" under the "Code Generation" option.
- Set "Use run-time library" to "Multithreaded DLL" under the "Code Generation" option. (NOTE: Using "Debug Multithreaded DLL" causes a LNK4098 warning)
- Link Tab:
- Added a /li
bpath option to "Project Options" that points to the cintools directory (absolute path).
Thanks for any help!
Naveen