DLL Problem

Started by
1 comment, last by beebs1 16 years, 11 months ago
Hiya, I'm having some trouble getting my DLL to compile, and I was wondering if anyone could have a quick look and see what the problem is. At the moment, all it needs to export is a factory function called bool CreateFileIStream( IFileIStream **ppStream );. The constructor of the abstract IFileIStream class needs to be protected, and have the factory function as a friend. It's a simple design, but because the factory function needs to be exported I'm not sure of the syntax and I can't find any similar examples anywhere.

class IFileIStream : public IFileStream
{

    friend extern "C" __declspec (dllexport) bool __stdcall CreateFileIStream( IFileIStream **ppFileIStream );

protected:

    // constructor, etc...

public:

    // etc...

}
If anyone could tell me the correct way of doing this I would be very grateful. Many thanks :)
Advertisement
I can't recall off hand if you can even export single member functions from a dll. How would that work? They aren't static so you would need an instance of the class to call them. And the class wasn't exported?

This may be what you want:

class __declspec (dllexport) IFileIStream : public IFileStream{...}


NB. Someone may well point out I'm an idiot and your original solution was correct with a minor syntax error. Buyer beware :-)

Alan
"There will come a time when you believe everything is finished. That will be the beginning." -Louis L'Amour
Thanks for the reply Alan. I just fixed it, by removing extern "C" - I was trying to declare a friend function that heppened to be exported, not export a single method.

Thanks anyway, appreciated [smile]

This topic is closed to new replies.

Advertisement