ovo je u .cpp : **************** //Demos calling a Win32 API function from a "straight C/C++" (non-MFC) DLL function library /**************************************************************** / C file: Roundme.cpp... / contains one trivial function called MakeWndRound() / / created 6/98 by Ray Mercer / Copyright (c) 1998, Ray Mercer. All rights reserved. /****************************************************************/ #define STRICT #include #include "roundme.h" /***************************************************************************** * Global variables * * * ******************************************************************************/ HINSTANCE hInst ; //dll's instance handle /***************************************************************************** * Public (Exportable) Functions * * * ******************************************************************************/ //Main DLL function //This is a window's DLL's equivalent to WinMain() BOOL WINAPI DllMain(HINSTANCE hInstA, DWORD dwReason, LPVOID lpvReserved) { switch (dwReason) { case DLL_PROCESS_ATTACH: // The DLL is being mapped into the process's address space hInst = hInstA; // Initialize here if necessary******* //************************************ // // break; case DLL_THREAD_ATTACH: // A thread is being created break; case DLL_THREAD_DETACH: // A thread is exiting cleanly break; case DLL_PROCESS_DETACH: // The DLL is being unmapped from the process's address space // Cleanup here if necessary************* //*************************************** hInst = 0; break; } return TRUE; } __declspec(dllexport) WINAPI brrazlicitih(int* niza, int* nizb, int koliko) { int i = 0; int vraca = 0; for (i = 0; i < koliko; i++) { if ( *(niza+i) != *(nizb+i) ) vraca++; } return vraca; } ovo je u .def: **************** LIBRARY RoundMe DESCRIPTION "Sample C function library by Ray Mercer" EXPORTS brrazlicitih @1 ovo je u .h : ************* /**************************************************************** / C file: Roundme.h... / contains one trivial function called MakeWndRound() / / created 6/98 by Ray Mercer / Copyright (c) 1998, Ray Mercer. All rights reserved. /****************************************************************/ //Exportable function prototypes __declspec(dllexport) WINAPI brrazlicitih( long broj); /********************************************************* //full syntax for import and export from 32bit DLLs: //EXPORTABLE SYNTAX: __declspec(dllexport) data_type int var_name; //(for variables) __declspec(dllexport) return_type func_name( [argument_list] ); //(for functions) //IMPORTABLE SYNTAX: __declspec(dllimport) data_type int var_name; //(for variables) __declspec(dllimport) return_type func_name( [argument_list] ); //(for functions) //SAMPLE USE OF DLL: __declspec(dllimport) int referenceCount; __declspec(dllimport) unsigned long DiskFree( lpStr DrivePath); ************************************************************/ a ima nesto i u external dependencies /basetsd.h : /**************************************************************** / C file: Roundme.h... / contains one trivial function called MakeWndRound() / / created 6/98 by Ray Mercer / Copyright (c) 1998, Ray Mercer. All rights reserved. /****************************************************************/ //Exportable function prototypes __declspec(dllexport) WINAPI brrazlicitih( long broj); /********************************************************* //full syntax for import and export from 32bit DLLs: //EXPORTABLE SYNTAX: __declspec(dllexport) data_type int var_name; //(for variables) __declspec(dllexport) return_type func_name( [argument_list] ); //(for functions) //IMPORTABLE SYNTAX: __declspec(dllimport) data_type int var_name; //(for variables) __declspec(dllimport) return_type func_name( [argument_list] ); //(for functions) //SAMPLE USE OF DLL: __declspec(dllimport) int referenceCount; __declspec(dllimport) unsigned long DiskFree( lpStr DrivePath); ************************************************************/