C/Front linking problems with VC++ 6.0 SP5

Hi, I will write a short C Tool in C/C++ which connect to our Navision Server, and write some Data to a Table. If I compile the SourceCode with Visual Studio 6.0 SP5 the Compiler throws no Errors, but if I would build the .exe File, the Linker throws a lot of Errors, but I don’t know how I can fix them. Can anybody help me? Here are the Errors: main.obj : error LNK2001: unresolved external symbol "void (__cdecl DBL_CloseDatabase)(void)" (?DBL_CloseDatabase@@3P6AXXZA) main.obj : error LNK2001: unresolved external symbol “void (__cdecl* DBL_DisconnectServer)(void)” (?DBL_DisconnectServer@@3P6AXXZA) main.obj : error LNK2001: unresolved external symbol “void (__cdecl* DBL_CloseCompany)(void)” (?DBL_CloseCompany@@3P6AXXZA) main.obj : error LNK2001: unresolved external symbol “void (__cdecl* DBL_CloseTable)(struct DBL_TABLE )" (?DBL_CloseTable@@3P6AXPAUDBL_TABLE@@@ZA) main.obj : error LNK2001: unresolved external symbol "void (__cdecl DBL_FreeRec)(struct DBL_REC )" (?DBL_FreeRec@@3P6AXPAUDBL_REC@@@ZA) main.obj : error LNK2001: unresolved external symbol "unsigned long (__cdecl DBL_InsertRec)(struct DBL_TABLE *,struct DBL_REC )" (?DBL_InsertRec@@3P6AKPAUDBL_TABLE@@PAUDBL_REC@@@ZA) main.obj : error LNK2001: unresolved external symbol "void (__cdecl DBL_AssignField)(struct DBL_TABLE ,struct DBL_REC ,long,unsigned short,void ,long)" (?DBL_AssignField@@3P6AXPAUDBL_TABLE@@PAUDBL_REC@@JGPAXJ@ZA) main.obj : error LNK2001: unresolved external symbol "unsigned short (__cdecl DBL_FieldType)(struct DBL_TABLE ,long)" (?DBL_FieldType@@3P6AGPAUDBL_TABLE@@J@ZA) main.obj : error LNK2001: unresolved external symbol "void (__cdecl DBL_InitRec)(struct DBL_TABLE ,struct DBL_REC )" (?DBL_InitRec@@3P6AXPAUDBL_TABLE@@PAUDBL_REC@@@ZA) main.obj : error LNK2001: unresolved external symbol "struct DBL_REC * (__cdecl DBL_AllocRec)(struct DBL_TABLE )" (?DBL_AllocRec@@3P6APAUDBL_REC@@PAUDBL_TABLE@@@ZA) main.obj : error LNK2001: unresolved external symbol "void (__cdecl DBL_EWT)(void)" (?DBL_EWT@@3P6AXXZA) main.obj : error LNK2001: unresolved external symbol "void (__cdecl DBL_DeleteRecs)(struct DBL_TABLE )" (?DBL_DeleteRecs@@3P6AXPAUDBL_TABLE@@@ZA) main.obj : error LNK2001: unresolved external symbol "void (__cdecl DBL_BWT)(void)" (?DBL_BWT@@3P6AXXZA) main.obj : error LNK2001: unresolved external symbol "unsigned long (__cdecl DBL_OpenTable)(struct DBL_TABLE * ,long)" (?DBL_OpenTable@@3P6AKPAPAUDBL_TABLE@@J@ZA) main.obj : error LNK2001: unresolved external symbol "void (__cdecl DBL_OpenCompany)(unsigned char const )" (?DBL_OpenCompany@@3P6AXPBE@ZA) main.obj : error LNK2001: unresolved external symbol "unsigned char * (__cdecl DBL_UserID)(void)" (?DBL_UserID@@3P6APAEXZA) main.obj : error LNK2001: unresolved external symbol "unsigned long (__cdecl DBL_Login)(unsigned char const ,unsigned char const )" (?DBL_Login@@3P6AKPBE0@ZA) main.obj : error LNK2001: unresolved external symbol "long (__cdecl DBL_UserCount)(void)" (?DBL_UserCount@@3P6AJXZA) main.obj : error LNK2001: unresolved external symbol "void (__cdecl DBL_OpenDatabase)(unsigned char const ,long,unsigned long)" (?DBL_OpenDatabase@@3P6AXPBEJK@ZA) main.obj : error LNK2001: unresolved external symbol "void (__cdecl DBL_ConnectServer)(unsigned char const *,unsigned char const *)” (?DBL_ConnectServer@@3P6AXPBE0@ZA) main.obj : error LNK2001: unresolved external symbol “long __cdecl DBL_Init(void)” (?DBL_Init@@YAJXZ)

You are trying to statically link these functions into your program - i.e. they need to exist in a .lib or .obj. However, with C/FRONT this is not the case. They are just exports in the .dll and you must declare them as function pointers only and load their addresses from the dll. This is done by libload.c, shipped with C/FRONT, and you can use that to load the addresses.

I used the function DBL_Init(); to load the Library, but it didn’t run. Here is the begining of my Sourcecode: #define SERVERNAME (DBL_U8*)“Navision” #define NETTYPE (DBL_U8*)“tcp” #define DATABASENAME (DBL_U8*)“Test.fdb” #define COMPANY (DBL_U8*)“Mustermann” #define CACHESIZE 1000 #define USECOMMITCACHE 1 void main() { if (0 != DBL_Init()) { printf(“DBL_Init failed\n”); // return(4711); } DBL_HTABLE hTable; DBL_BOOL RemoteMode = 1; if(RemoteMode) DBL_ConnectServer(SERVERNAME,NETTYPE); else DBL_OpenDatabase(DATABASENAME,CACHESIZE,USECOMMITCACHE); if(DBL_UserCount() > 0) { DBL_Login(USERNAME,PASSWD); printf(“Aktuelle UserID: %s\n”, DBL_UserID()); } DBL_OpenCompany(COMPANY); . . . . So I didn’t know, what I did wrong.

I have found the problem. I wrote the tool in C++ and the libload.c was compiled with the C-Compiler. After I compiled the libload.c with the C+±Compiler it runs fine.

libload.c wasn’t changed more then 5 years, they adding onlly new func. links. Linear programing style. :slight_smile: Rewrite it to OOP style. In constructor place path as parm. That fixes a lot of problems then more than one of instance are called.