Subj : Re: Link DLL using BCC32 free compiler To : borland.public.cpp.borlandcpp From : Ed Mulroy [TeamB] Date : Wed Aug 04 2004 07:25 am One of two things: - The C and C++ languages specify a main that does not have a calling argument of 'void'. Change to 'int main()' - The function prototype: > __declspec(dllimport) void __stdcall DLLFunction1(int num); has a return type of 'void' meaning it does not return anything. However you try to use a return value in this line: > int ret_val=DLLFunction1(6); You are using the command line tools from C++ Builder but are posting questions to the newsgroup for the old Borland C++ compiler. Post questions about your compiler to newsgroups with 'cppbuilder' in their name. .. Ed > Doug Martin wrote in message > news:41109f2e$1@newsgroups.borland.com... > > How is a DLL linked to an application using the free command > line compiler, BCC32 (version 5.5)? Both are written in ANSI C. > > For example, if MyDLL.c is: > > __declspec(dllexport) int __stdcall DLLFunction1(int num) > { return(2*num); } > > It is compiled to a DLL at the command line using: > > > bcc32 -WD MyDLL.c > > to generate MyDLL.dll, MyDLL.obj. and MyDLL.tds. Then the lib > file is generated using: > > > implib MyDLL.lib MyDLL.dll > > Both MyDLL.lib MyDLL.dll are added to the project directory. If the application, named test_MyDLL.c is: > > __declspec(dllimport) void __stdcall DLLFunction1(int num); > int main(void){ > int ret_val=DLLFunction1(6); > return 0; > } > > the compiler error is: > > Error E2468 test_MyDLL.c 3: Value of type void is not allowed in > function main .