07-17-2006 05:59 PM
#ifdef
DLL2_EXPORTS#define
DLL2_API __declspec(dllexport)#else
#define
DLL2_API __declspec(dllimport)#endif
#include "Subclass.h"
class
DLL2_API SuperClass{public
:SuperClass(
void);~SuperClass(
void);Subclass *AZ;
Subclass *EL;
};
extern
DLL2_API Subclass *ptr1;extern
DLL2_API Subclass *ptr2;I can get the superclass to work all by itself until I add the instantiation of the subclass. The compiler gives me a bunch of unresolved externals that are mostly concerning the subclass. The Subclass is really simple. All it has are a bunch of private variables, some set and get functions and some simple calculations. Most of the functions that I want to be able to use in Labview may be accessing the ptr1 and ptr2 information like so:
double returnSubclassVariable(index)
{
return ptr1[index].getSubclassVar();
}
Question 1: Can LabVIEW make use of this function even though it has Subclass usage?
Question 2: What syntax needs to be added to a basic "subclass" definition to make this possible? Does the subclass have to be its own DLL? Be mindful, I have never worked with DLLs before today, so try to keep it dumb for me. If the answers to these questions are too complicated, at least a "yes it's possible" would give me a glimmer of hope. Thanks a lot!
07-18-2006 04:21 PM
07-18-2006 04:38 PM
I am very new to DLLs. It appears that I had not made sure that both of my classes were being compiled. It seemed to have take care of the errors. I'm a little worried now after seeing the post you refered me to, because I didn' make a COM dll (I don't think) and I was able to acess my functions in labVIEW. I didn't use the __stdcall or anything though. My function headers look something like this:
MYDLL_API functionName()
will this cause me problems for reasons I may be unaware?
I also haven't been able to really test my functions because I have variables in my dll that have yet to be populated. I want to populate them using another c++ file but I'm getting something wrong. How do you include/import a dll into a regular old c++ program. I thought #import "mydll.dll" was what I needed but the error it gave me was
fatal error C1083: Cannot open type library file: 'mydll.dll': Error loading type library/DLL.
07-19-2006 04:38 PM