Help with LoadLibrary and DLL
- From: "omegayen " <omegayen@xxxxxxxxxxxxx>
- Date: Mon, 21 Dec 2009 03:45:06 +0000 (UTC)
Hi,
I am try to follow the example on http://guoliangye.com/2009/01/21/how-to-write-a-dll-in-cc-and-call-it-in-matlab/
I created two files
dll1.h
#ifndef MY_API
#define MY_API extern "C" __declspec(dllexport)
#endif
MY_API int add(int a, int b);
MY_API int sub(int a, int b);
dll1.cpp
#ifndef MY_API
#define MY_API extern "C" __declspec(dllexport)
#endif
#include "dll1.h"
int add(int a,int b)
{
return a + b;
}
int sub(int a,int b)
{
return a - b;
}
I think used Visual Studio 2008 SP1 Version 9 Pro on Windows Vista 64 bit using Matlab 2009b 64 bit to compile a x64 dll file.
I then use load library function such as loadlibrary('D:\dll1\Debug\dll1.dll', 'D:\dll1\dll1.h'); in MATLAB
when I do this i get the error message
??? Error using ==> loadlibrary at 422
Building SimpleDll_thunk_pcwin64 failed. Compiler output is:
SimpleDll_thunk_pcwin64.c
C:\Users\user_name_removed\Documents\Visual Studio 2008\Projects\SimpleDll\x64\Debug\SimpleDll.h(4) : error C2059: syntax error :
'string'
C:\Users\user_name_removed\Documents\Visual Studio 2008\Projects\SimpleDll\x64\Debug\SimpleDll.h(5) : error C2059: syntax error :
'string'
can anyone help tell me why I am getting error C2059 syntax error 'string' I suspect it has something to do with the extern "C" __declspec(dllexport) line but am not sure how to change things up to work. thanks .
- Follow-Ups:
- Re: Help with LoadLibrary and DLL
- From: Philip Borghesani
- Re: Help with LoadLibrary and DLL
- Prev by Date: lsqcurvefit z(x,y)
- Next by Date: Re: lsqcurvefit z(x,y)
- Previous by thread: lsqcurvefit z(x,y)
- Next by thread: Re: Help with LoadLibrary and DLL
- Index(es):
Relevant Pages
|