T
T
tvsjke2016-03-22 13:43:26
C++ / C#
tvsjke, 2016-03-22 13:43:26

How to dynamically link a dll?

I want to work with Sqlite under WinCE.
I downloaded the archive , then according to the documentation I made a dll with either. Created MFC Smart Device project, in it

#pragma comment(lib,"sqlDll.lib")
#include "sqlite3.h"

sqlite3_open("test.db", &db);

When compiling: LNK2019: unresolved external symbol
Google says that most likely I forgot to include the library. But I connected. Perhaps I created the dll incorrectly? I did this: win32 application -> dll library, added all .c and .h files, added a .def file in the linker. I got 5 files at the output: .lib, .dll, .exp, .pdb, .ilk
What am I doing wrong?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alexander Ananiev, 2016-03-22
@tvsjke

In the linker, you need to register the lib file. In this case, the sqlite.c file does not need to be added to the project, the sqlite.h file is enough.
If you don't want sqlite to be a standalone dll, then just add the sources (.c and .h) sqlite to the project and you don't need to configure anything else.

T
tvsjke, 2016-03-22
@tvsjke

I did not understand about "In the linker you need to register a lib file" - is it when creating a dll (then what lib file)? Or already when it is connected (then why, if I connect via pragma)?

N
Nikolai Romanovich, 2016-03-22
@MikalaiR

#pragma comment(lib,"sqlDll.lib")
extern "C" {
#include "sqlite3.h"
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question