We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
一个.h文件DllDemo.h
extern "C" //原样编译 { DllAPI int __stdcall Max(int a,int b); //__stdcall使非C/C++语言内能够调用API }
在DllDemo.cpp文件中导入DllDemo.h文件,并实现Max(int,int)函数
DllAPI int __stdcall Max(int a,int b) { if(a==b) return NULL; else if(a>b) return a; else return b; }
The text was updated successfully, but these errors were encountered:
If you look in the GettingStarted documentation ( https://github.com/mono/CppSharp/blob/master/docs/GettingStarted.md ) there is an example of how to get started with CppSharp.
The basics are:
Your implementation of ILibrary should look something like this:
class DllDemoGenerator : ILibrary { static void Main(string[] args) { ConsoleDriver.Run(new DllDemoGenerator()); } void Setup(Driver driver) { var options = driver.Options; options.GeneratorKind = LanguageGeneratorKind.CSharp; options.LibraryName = "DllDemo"; options.Headers.Add("DllDemo.h"); options.Libraries.Add("DllDemo.lib"); } public void SetupPasses(Driver driver){} public void Preprocess(Driver driver, CppSharp.AST.Library lib){} public void Postprocess(CppSharp.AST.Library lib){} }
If you have more questions you should check the documentation first.
Sorry, something went wrong.
Thanks , this is Simpler than the GettingStarted documentation ~ Actually , I checked the documentation ……
No branches or pull requests
一个.h文件DllDemo.h
ifdef DllDemo_EXPORTS
define DllAPI __declspec(dllexport)
else
define DllAPI __declspec(dllimport)
extern "C" //原样编译
{
DllAPI int __stdcall Max(int a,int b); //__stdcall使非C/C++语言内能够调用API
}
endif
在DllDemo.cpp文件中导入DllDemo.h文件,并实现Max(int,int)函数
include "DllDemo.h"
DllAPI int __stdcall Max(int a,int b)
{
if(a==b)
return NULL;
else if(a>b)
return a;
else
return b;
}
The text was updated successfully, but these errors were encountered: