{"id":3888,"date":"2014-03-30T06:11:04","date_gmt":"2014-03-30T06:11:04","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/problems-using-a-c-dll-collection-of-common-programming-errors\/"},"modified":"2014-03-30T06:11:04","modified_gmt":"2014-03-30T06:11:04","slug":"problems-using-a-c-dll-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/problems-using-a-c-dll-collection-of-common-programming-errors\/","title":{"rendered":"problems using a C dll.-Collection of common programming errors"},"content":{"rendered":"<p>I&#8217;m creating a dll using MingW, the functions are exported as<\/p>\n<pre>extern HsInt32 __attribute__((__stdcall__)) genNumberSec(HsInt64 a1);\n<\/pre>\n<p>and after compilation the dll&#8217;s Export table contains among other<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 8972 230B 00002DF0 genNumberSec@8<\/p>\n<p>so far so good. Creating a test app and compiling using the gcc in MingW also worksfunction imported as<\/p>\n<pre>extern int __attribute__((__stdcall__)) genNumberSec (long long int var1);\n<\/pre>\n<p>and this works fine,however the problems come when I try and use VC++ to access this dll.I first create a DEF file which containsLIBRARY WinDllEXPORTS<\/p>\n<p>\u00a0 genNumberSec@8<\/p>\n<p>and then call lib to create the .LIB file.I add this to my VC++ project and use as an import statement<\/p>\n<pre>extern \"C\" __declspec(dllimport) int __stdcall genNumberSec (long long int var1);\n<\/pre>\n<p>\nIt&#8217;s able to compile and link the program, but at runtime it&#8217;s not able to find the entry point for genNumberSec.<\/p>\n<p>the precise error is &#8220;The procedure entry point genNumberSec@8 could not be located in the dynamic link library WinDll.dll&#8221;<\/p>\n<p>but running dumpbin \/EXPORTS WinDll shows again that it&#8217;s in the table.<\/p>\n<p>Anyone have any suggestions?<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;m creating a dll using MingW, the functions are exported as extern HsInt32 __attribute__((__stdcall__)) genNumberSec(HsInt64 a1); and after compilation the dll&#8217;s Export table contains among other \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 8972 230B 00002DF0 genNumberSec@8 so far so good. Creating a test app and compiling using the gcc in MingW also worksfunction imported as extern int __attribute__((__stdcall__)) genNumberSec (long [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-3888","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/3888","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=3888"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/3888\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=3888"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=3888"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=3888"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}