|
From: | Honza Bajer |
Subject: | [Confuse-devel] Problem with libConfuse in Visual Studio 2008 |
Date: | Thu, 22 Jul 2010 14:19:19 +0200 |
User-agent: | Mozilla/5.0 (Windows; U; Windows NT 6.1; cs; rv:1.9.2.7) Gecko/20100713 Thunderbird/3.1.1 |
Hi,
Im trying to port my Linux application to Windows and I have a problem with calling cfg_init() from libconfuse.dll. Loading of this dll with LoadLibraryA() and getting methods from dll with GetProcAddress() is without any problem or error. typedef cfg_t *(*CFG_INIT_FPTR)(cfg_opt_t *opts, cfg_flag_t flags); CFG_INIT_FPTR cfg_init; cfg_init = (CFG_INIT_FPTR)GetProcAddress(hinstLib, DLLSYM("cfg_init")); if(cfg_init) { cfg = cfg_init(opts, 0); } I figured out, that problem is probably in the structures for this method (In Ubuntu it works without any problem) because with expamle structure from wincfgtest.c everything works fine: cfg_opt_t opts[] = { CFG_BOOL("bool", cfg_false, 0), CFG_STR("string", "default test string", 0), CFG_INT("number", 17, 0), CFG_FLOAT("float", 6.789, 0), CFG_FUNC("message", &cb_message), CFG_END() }; but with my structures for cfg_init() a get an error when I try to call this method: "Access Violation Exception" and something about memory corruption My structures are these: cfg_opt_t bookmark_us[] = { CFG_INT("port", /*PORT_UZIVATEL*/ 8900, 0), CFG_BOOL("standard_connection", cfg_true, 0), CFG_INT("ssl_port", /*PORT_UZIVATEL_SSL*/ 5, 0), CFG_INT("max_users", /*MAX_USERS*/ 10, 0), CFG_INT("max_ssl_users", /*MAX_SSL_USERS*/ 10, 0), CFG_BOOL("ssl", cfg_true, 0), CFG_INT("sec_level", /*SECURITY_LEVEL*/ 1, 0), CFG_INT("sec_depth", /*SECURITY_DEPTH*/ 1, 0), CFG_STR("authority", "nic", 0), CFG_STR("certificate", /*CERTT*/ "certifikat", 0), CFG_STR("key", /*KLIC*/ "klic", 0), CFG_STR("hosts", "hosts", 0), CFG_END() }; cfg_opt_t bookmark_cl[] = { CFG_INT("port", /*PORT_KLIENT*/ 8888, 0), CFG_INT("max_clients", /*MAX_CLIENTS*/ 100, 0), CFG_INT("wake_port", /*WAKE_PORT*/ 9, 0), CFG_INT("wake_timeout", /*WAKE_TIM*/ 5, 0), CFG_INT("wake_repeat", /*WAKE_REPEAT*/ 2, 0), CFG_INT("timeout", /*TIMEOUT* / 5, 0), CFG_BOOL("ssl", cfg_true, 0), CFG_INT("sec_level", /*SECURITY_LEVEL*/ 1, 0), CFG_INT("sec_depth", /*SECURITY_DEPTH*/ 1, 0), CFG_STR("authority", "nic", 0), CFG_STR("certificate", "ccc" /*CERTT*/, 0), CFG_STR("key", /*KLIC*/ "kkk", 0), CFG_INT("ping_timeout", /*PING_TIMEOUT*/ 2, 0), CFG_INT("ping_repeat", /*PING_REPEAT*/ 5, 0), CFG_END() }; cfg_opt_t opts[] = { CFG_INT("logging", /*DEPTH_OF_LOGGING*/ 1, /*CFGF_NONE*/ 0), CFG_STR("user_name", "primary_user", /*CFGF_NONE*/ 0), CFG_STR("client_name", "primary_client", /*CFGF_NONE*/ 0), CFG_BOOL("file_log", cfg_false, /*CFGF_NONE*/ 0), CFG_BOOL("system_log", cfg_true, /*CFGF_NONE*/ 0), CFG_STR("log_file_name", /*LOGFILE*/ "string", 0), CFG_SEC("section_user", bookmark_us, CFGF_MULTI | CFGF_TITLE), CFG_SEC("section_client", bookmark_cl, CFGF_MULTI | CFGF_TITLE), CFG_END() }; Commented parts are my default defined values. Im using Visual Studio 2008 (Visual C++) with libConfuse 2.7. I really dont know, where is the problem. Thans for any advice. |
[Prev in Thread] | Current Thread | [Next in Thread] |