C dilinden anlayanlar bakabilir mi

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);
}
 
İnternette şöyle bir tarif buldum:


  1. Make sure you have MATLAB Compiler and a supported C compiler
  2. Run the command mbuild -setup to select your C compiler
  3. Enter deploytool to open the deployment tool window; create a new project at the prompt
  4. Under the "build" tab, click the links "add main file" and "add files/directory" and add your MATLAB GUI code files (and data files, if necessary)
  5. Click the "build" button.
Senin asıl ilacın: https://www.google.com.tr/search?q=...j7&sourceid=chrome&espv=210&es_sm=93&ie=UTF-8
 
Bu c / c++ winapi ile yazılmış vede winapi biraz zor eğer yardım istersen ***@*** a mail at ben sana yardım ederim
 
Moderatör tarafında düzenlendi:

Yeni mesajlar

Forum istatistikleri

Konular
128,189
Mesajlar
915,718
Kullanıcılar
449,957
Son üye
sezercakmak

Yeni konular

Geri
Üst