0
votes

I have an old c dll that I want to convert to a COM server.

It only exposes one function.

This is what I have done: I created an ATL project in VS 2010 added a simple ATL object with a wrapper function. I added the c sources and headers In the wrapper function I call the c function, I added the full function prototype as described in http://www.parashift.com/c++-faq-lite/mixing-c-and-cpp.html#faq-32.5.

The following error appears:

Unresolved external symbol referenced in function

I tried everything.

Any idea?

2
What is the full error message/unresolved symbol?Dmitry Shkuropatsky
Error 1 error LNK2019: unresolved external symbol _CreateGifFromEq referenced in function "public: virtual long __stdcall CMimeTexWrapper::CreateGifFromEqWrapper(wchar_t *,wchar_t *)" (?CreateGifFromEqWrapper@CMimeTexWrapper@@UAGJPA_W0@Z) C:\Users\John\Documents\Visual Studio 2010\Projects\MimeTexCOM\MimeTexWrapper.obj MimeTexCOMBCartolo
You are forgetting to link the old DLL import library.Hans Passant
It is not a library, but source code. I want to make a COM dll instead of a win32 dll. But the source code is the same plus whatever is needed to make a COM dll. In my case, since I only need one function I created a simple atl object and added a wrapper function. But thanksBCartolo

2 Answers

1
votes

You need to use extern "C" when including the c-source:

extern "C" {
    #include "header.h"
}
1
votes

You might try compile the c dll to a regular win32 dll, then calling it from you COM dll through a wrapper. You would need 2 dlls, but if the original DLL will compile fine, you should be able to use it from COM.