Here is a small test bit of code using one simple alert box from the static libs. Perhaps you can spot what I'm doing wrong. At least we can have some code as a basis of further discussion --
Code:
========================
first.h
========================
#define DONT_REDEFINE
#include <windows.h>
Code:
========================
cdll.h
========================
#define DONT_REDEFINE
#define DLL extern "C" __declspec(dllexport)
#define DLL_C extern __declspec(dllexport)
#define DLL_IN extern "C" __declspec(dllimport)
#define CALLCONV __stdcall
//#define CALLCONV __cdecl
#include "fapi.h"
#include "fdetypes.h"
// API function for alert from fapi.h
// It is in a block of code that also has the requisite
// #if define __cplusplus extern "C" preprocessor.
extern IntT F_ApiAlert FARGS((ConStringT message, IntT type));
//exported function
int CALLCONV StartAPI(int);
Code:
========================
startAPI
========================
// startapi.cpp : Used to connect to the API (once FM is started).
#include "first.h"
#include "c_dll.h"
int CALLCONV StartAPI(int init)
{
IntT status = init;
ConStringT s = "Greetings from inside StartAPI";
F_ApiAlert(greeting, FF_ALERT_CONTINUE_NOTE);
return status;
}
Code:
========================
cdll.def
========================
LIBRARY c_dll
EXPORTS
StartAPI @1
When compiler and above code set to __cdecl = compiles.
When compiler and above code set to __stdcall = fails with:
Code:
StartAPI.cpp
Generating Code...
StartAPI.obj : error LNK2019: unresolved external symbol _F_ApiAlert@8 referenced in function "int __stdcall StartAPI(int)" (?StartAPI@@YGHH@Z)
C:\Users\mikesmi.CISCO\Desktop\Local Working Folder\c_dll\c_dll\Debug\c_dll.dll : fatal error LNK1120: 1 unresolved externals