gogtug
Üye
- Katılım
- 30 Eki 2013
- Mesajlar
- 41
- Puanları
- 1
toplama 23 dosyanın adı ben bunu matlabda yazdım sadece 2 sayıyı topluyo bunuda matlabın kendi dönüştürücüsünü kullanarak c koduna çevirdi ' c source , h header file, bide birkaç dll dosyası olurturdu ' ben bunlarla bi arayüz oluşturup herhengi bi bilgisayarda çalıştırabilirmyim sorum bu ? bu kodlar işe yararmı yani ?
*
* MATLAB Compiler: 4.18.1 (R2013a)
* Date: Sat Apr 05 15:14:12 2014
* Arguments: "-B" "macro_default" "-B" "csharedlib:libtoplama23" "-W"
* "lib:libtoplama23" "-T" "link:lib" "toplama23.m"
*/
#include <stdio.h>
#define EXPORTING_libtoplama23 1
#include "libtoplama23.h"
static HMCRINSTANCE _mcr_inst = NULL;
#if defined( _MSC_VER) || defined(__BORLANDC__) || defined(__WATCOMC__) || defined(__LCC__)
#ifdef __LCC__
#undef EXTERN_C
#endif
#include <windows.h>
static char path_to_dll[_MAX_PATH];
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, **** *pv)
{
if (dwReason == DLL_PROCESS_ATTACH)
{
if (GetModuleFileName(hInstance, path_to_dll, _MAX_PATH) == 0)
return FALSE;
}
else if (dwReason == DLL_PROCESS_DETACH)
{
}
return TRUE;
}
#endif
#ifdef __cplusplus
extern "C" {
#endif
static int mclDefaultPrintHandler(const char *s)
{
return mclWrite(1 /* stdout */, s, sizeof(char)*strlen(s));
}
#ifdef __cplusplus
} /* End extern "C" block */
#endif
#ifdef __cplusplus
extern "C" {
#endif
static int mclDefaultErrorHandler(const char *s)
{
int written = 0;
size_t len = 0;
len = strlen(s);
written = mclWrite(2 /* stderr */, s, sizeof(char)*len);
if (len > 0 && s[ len-1 ] != '\n')
written += mclWrite(2 /* stderr */, "\n", sizeof(char));
return written;
}
#ifdef __cplusplus
} /* End extern "C" block */
#endif
/* This symbol is defined in shared libraries. Define it here
* (to nothing) in case this isn't a shared library.
*/
#ifndef LIB_libtoplama23_C_API
#define LIB_libtoplama23_C_API /* No special import/export declaration */
#endif
LIB_libtoplama23_C_API
bool MW_CALL_CONV libtoplama23InitializeWithHandlers(
mclOutputHandlerFcn error_handler,
mclOutputHandlerFcn print_handler)
{
int bResult = 0;
if (_mcr_inst != NULL)
return true;
if (!mclmcrInitialize())
return false;
if (!GetModuleFileName(GetModuleHandle("libtoplama23" ), path_to_dll, _MAX_PATH))
return false;
{
mclCtfStream ctfStream =
mclGetEmbeddedCtfStream(path_to_dll);
if (ctfStream) {
bResult = mclInitializeComponentInstanceEmbedded( &_mcr_inst,
error_handler,
print_handler,
ctfStream);
mclDestroyStream(ctfStream);
} else {
bResult = 0;
}
}
if (!bResult)
return false;
return true;
}
LIB_libtoplama23_C_API
bool MW_CALL_CONV libtoplama23Initialize(****)
{
return libtoplama23InitializeWithHandlers(mclDefaultError Handler,
mclDefaultPrintHandler);
}
LIB_libtoplama23_C_API
**** MW_CALL_CONV libtoplama23Terminate(****)
{
if (_mcr_inst != NULL)
mclTerminateInstance(&_mcr_inst);
}
LIB_libtoplama23_C_API
**** MW_CALL_CONV libtoplama23PrintStackTrace(****)
{
char** stackTrace;
int stackDepth = mclGetStackTrace(&stackTrace);
int i;
for(i=0; i<stackDepth; i++)
{
mclWrite(2 /* stderr */, stackTrace, sizeof(char)*strlen(stackTrace));
mclWrite(2 /* stderr */, "\n", sizeof(char)*strlen("\n"));
}
mclFreeStackTrace(&stackTrace, stackDepth);
}
LIB_libtoplama23_C_API
bool MW_CALL_CONV mlxToplama23(int nlhs, mxArray *plhs[], int nrhs, mxArray *prhs[])
{
return mclFeval(_mcr_inst, "toplama23", nlhs, plhs, nrhs, prhs);
}
LIB_libtoplama23_C_API
bool MW_CALL_CONV mlfToplama23(int nargout, mxArray** varargout, mxArray* varargin)
{
return mclMlfFeval(_mcr_inst, "toplama23", nargout, -1, -1, varargout, varargin);
}
*
* MATLAB Compiler: 4.18.1 (R2013a)
* Date: Sat Apr 05 15:14:12 2014
* Arguments: "-B" "macro_default" "-B" "csharedlib:libtoplama23" "-W"
* "lib:libtoplama23" "-T" "link:lib" "toplama23.m"
*/
#include <stdio.h>
#define EXPORTING_libtoplama23 1
#include "libtoplama23.h"
static HMCRINSTANCE _mcr_inst = NULL;
#if defined( _MSC_VER) || defined(__BORLANDC__) || defined(__WATCOMC__) || defined(__LCC__)
#ifdef __LCC__
#undef EXTERN_C
#endif
#include <windows.h>
static char path_to_dll[_MAX_PATH];
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, **** *pv)
{
if (dwReason == DLL_PROCESS_ATTACH)
{
if (GetModuleFileName(hInstance, path_to_dll, _MAX_PATH) == 0)
return FALSE;
}
else if (dwReason == DLL_PROCESS_DETACH)
{
}
return TRUE;
}
#endif
#ifdef __cplusplus
extern "C" {
#endif
static int mclDefaultPrintHandler(const char *s)
{
return mclWrite(1 /* stdout */, s, sizeof(char)*strlen(s));
}
#ifdef __cplusplus
} /* End extern "C" block */
#endif
#ifdef __cplusplus
extern "C" {
#endif
static int mclDefaultErrorHandler(const char *s)
{
int written = 0;
size_t len = 0;
len = strlen(s);
written = mclWrite(2 /* stderr */, s, sizeof(char)*len);
if (len > 0 && s[ len-1 ] != '\n')
written += mclWrite(2 /* stderr */, "\n", sizeof(char));
return written;
}
#ifdef __cplusplus
} /* End extern "C" block */
#endif
/* This symbol is defined in shared libraries. Define it here
* (to nothing) in case this isn't a shared library.
*/
#ifndef LIB_libtoplama23_C_API
#define LIB_libtoplama23_C_API /* No special import/export declaration */
#endif
LIB_libtoplama23_C_API
bool MW_CALL_CONV libtoplama23InitializeWithHandlers(
mclOutputHandlerFcn error_handler,
mclOutputHandlerFcn print_handler)
{
int bResult = 0;
if (_mcr_inst != NULL)
return true;
if (!mclmcrInitialize())
return false;
if (!GetModuleFileName(GetModuleHandle("libtoplama23" ), path_to_dll, _MAX_PATH))
return false;
{
mclCtfStream ctfStream =
mclGetEmbeddedCtfStream(path_to_dll);
if (ctfStream) {
bResult = mclInitializeComponentInstanceEmbedded( &_mcr_inst,
error_handler,
print_handler,
ctfStream);
mclDestroyStream(ctfStream);
} else {
bResult = 0;
}
}
if (!bResult)
return false;
return true;
}
LIB_libtoplama23_C_API
bool MW_CALL_CONV libtoplama23Initialize(****)
{
return libtoplama23InitializeWithHandlers(mclDefaultError Handler,
mclDefaultPrintHandler);
}
LIB_libtoplama23_C_API
**** MW_CALL_CONV libtoplama23Terminate(****)
{
if (_mcr_inst != NULL)
mclTerminateInstance(&_mcr_inst);
}
LIB_libtoplama23_C_API
**** MW_CALL_CONV libtoplama23PrintStackTrace(****)
{
char** stackTrace;
int stackDepth = mclGetStackTrace(&stackTrace);
int i;
for(i=0; i<stackDepth; i++)
{
mclWrite(2 /* stderr */, stackTrace, sizeof(char)*strlen(stackTrace));
mclWrite(2 /* stderr */, "\n", sizeof(char)*strlen("\n"));
}
mclFreeStackTrace(&stackTrace, stackDepth);
}
LIB_libtoplama23_C_API
bool MW_CALL_CONV mlxToplama23(int nlhs, mxArray *plhs[], int nrhs, mxArray *prhs[])
{
return mclFeval(_mcr_inst, "toplama23", nlhs, plhs, nrhs, prhs);
}
LIB_libtoplama23_C_API
bool MW_CALL_CONV mlfToplama23(int nargout, mxArray** varargout, mxArray* varargin)
{
return mclMlfFeval(_mcr_inst, "toplama23", nargout, -1, -1, varargout, varargin);
}