The invention provides an automatic code generating method and an automatic code generating device for loading a dynamic link
library. The device comprises an extracting rule editing module, a
function prototype and constant definition extracting module, a code template and parameter transformation rule editing module and an
object code generating module, wherein the extracting rule editing module is used for defining an extracting rule for an extracting module; the
function prototype and constant definition extracting module is used for extracting a
function prototype and constant definition
list from a header file according to the defined extracting rule; the code template and parameter transformation rule editing module is used for editing a code template and parameter transformation rule; and the
object code generating module is used for selecting a corresponding code template and parameter transformation rule according to an
object code language and a filling mode, and is used for transforming function prototype and constant definition into object
programming language codes. By the scheme, loading codes are generated automatically, demands on developers are reduced, and the developers do not need to concern
dynamic loading and
static loading specific implementing methods of the DLL (dynamic link
library) under optional
programming languages, and do not need to be familiar with corresponding relations of parameter types under different languages.