I am trying to produce a dll from a static library + header file in order to make it as a plugin for another python project.
(https://github.com/muggot/myphone3/tree/master/h323plus/plugins/audio/VoiceAgeG729/va_g729)
But, I am getting linker errors which I can't figure the real reason behind them.
I tried the accepted answer in [1], but the librarian is not working ( unable to start correctly) so I couldn't make it.
Here is my code for the dll which will wrap one function as example
Win32Project2.h
#ifdef WIN32PROJECT2_EXPORTS
#define WIN32PROJECT2_API __declspec(dllexport)
#else
#define WIN32PROJECT2_API __declspec(dllimport)
#endif
#include <C:\Users\user name\Desktop\CELP/va_g729.h>
#pragma comment(lib, "va_g729.lib")
WIN32PROJECT2_API void fnWin32Project2(void);
dllmain.cpp
#include "stdafx.h"
BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
Win32Project2.cpp
#include "stdafx.h"
#include "Win32Project2.h"
#include <C:\Users\user name\Desktop\CELP\va_g729.h>
// This is an example of an exported function.
WIN32PROJECT2_API void fnWin32Project2(void)
{
return va_g729a_init_encoder(); // A function inside the .lib
}
I added the directory of the .h into project's properties->C/C++->general->Aditional include directories and added the lib path into linker->general->additional libraries directory Finally, added the .lib itself into linker->input->additional dependencies
but, I got the following linker errors: error LNK1120: 1 unresolved externals Error1 error LNK2001: unresolved external symbol "void __cdecl va_g729a_init_encoder(void)" (?va_g729a_init_encoder@@YAXXZ)
I understand that linker can't find the function, but why? did I mess something?