C/Front DBL_ConnectServer VC++7

I have some trouble with C/Front. I want simply connect to a Navision Server in our Network. I wrote a short Code in Visual C++ .Net but VC give me only some Errors: Here my SourceCode: #include “CF.h” #include <stdio.h> #include <stdlib.h> #include <string.h> #define SERVERNAME “Navision2” #define NETTYPE “tcp” int main() { DBL_ConnectServer(SERVERNAME, NETTYPE); DBL_DisconnectServer(); return(0); } The two Errors: error C2664: ‘void (const DBL_U8 *,const DBL_U8 *)’ : cannot convert parameter 2 from ‘const char [4]’ to ‘const DBL_U8 *’ error C2664: ‘void (const DBL_U8 *,const DBL_U8 *)’ : cannot convert parameter 1 from ‘const char [4]’ to ‘const DBL_U8 *’ What’s wrong with my Code?

By default (is changeable by a switch) the compiler will take your text constants as char* (i.e. signed), but the DBL_U8* type is actually unsigned char*, and there is no implicit cast from signed to unsigned or vice-versa, so you must cast your #define constants yourself: DBL_ConnectServer((DBL_U8*)SERVERNAME, (DBL_U8*)NETTYPE); …or instead change your #defines to, e.g.: #define SERVERNAME (DBL_U8*)“Navision2” …or, preferably, if you are using c++ use const instead of #define: const DBL_U8* SERVERNAME = (DBL_U8*)“Navision2”; Either way you must cast.

Thanx for the fast answer. I changed it in my Sourcecode and it runs fine.

Now I have another Problem with this funktion. If the Method DBL_ConnectServer(SERVERNAME,NETTYPE); is called, the Programm crashs with the following Error. C-Front-Test.exe - Application Error --------------------------- The instruction at “0x00000000” referenced memory at “0x00000000”. The memory could not be “read”. Has anybody an idea?

You have to load all the c/front function pointers from the dll before you can use them - an example of how to do this is in libload.c that comes with see front. Take a look at that and at sample.c.

Oh, thanx! I thought the CF.h Header File did this. I think it is better when i make a excourse in C/C++. I hope that I now understood it :wink: