Hello,
I am trying to build a Xojo module plugin manually from Visual Studio 2019 and I am running into errors. How do I make a simple dll with Visual Studio 2019 for Xojo? One error occurs when a file called rb_plugin_deprecated.h is not included. The VS settings are Release x86.
PluginMain.cpp
1>C:\\Test\\TestDLL\\TestDLL\\rb_plugin.h(21): fatal error C1083: Cannot open include file: 'rb_plugin_deprecated.h': No such file or directory
1>TestDLL.cpp
1>C:\\Test\\TestDLL\\TestDLL\\rb_plugin.h(21): fatal error C1083: Cannot open include file: 'rb_plugin_deprecated.h': No such file or directory
1>Done building project "TestDLL.vcxproj" -- FAILED.
When I include rb_plugin_deprecated.h, then I get many errors:
PluginMain.cpp
1>C:\\Test\\TestDLL\\TestDLL\\PluginMain.cpp(2480): warning C4244: 'argument': conversion from 'double' to 'RBInteger', possible loss of data
1>C:\\Test\\TestDLL\\TestDLL\\PluginMain.cpp(3117): warning C4244: 'argument': conversion from 'double' to 'RBInteger', possible loss of data
1>C:\\Test\\TestDLL\\TestDLL\\PluginMain.cpp(3225): error C4996: 'REALGetControlGraphicsWithDC': was declared deprecated
1>C:\\Test\\TestDLL\\TestDLL\\PluginMain.cpp(3214): note: see declaration of 'REALGetControlGraphicsWithDC'
1>TestDLL.cpp
1>C:\\Test\\TestDLL\\TestDLL\\PluginMain.cpp(2480): warning C4244: 'argument': conversion from 'double' to 'RBInteger', possible loss of data
1>C:\\Test\\TestDLL\\TestDLL\\PluginMain.cpp(3117): warning C4244: 'argument': conversion from 'double' to 'RBInteger', possible loss of data
1>C:\\Test\\TestDLL\\TestDLL\\PluginMain.cpp(3225): error C4996: 'REALGetControlGraphicsWithDC': was declared deprecated
1>C:\\Test\\TestDLL\\TestDLL\\PluginMain.cpp(3214): note: see declaration of 'REALGetControlGraphicsWithDC'
1>C:\\Test\\TestDLL\\TestDLL\\TestDLL.cpp(12): error C2059: syntax error: '}'
1>C:\\Test\\TestDLL\\TestDLL\\TestDLL.cpp(12): error C2143: syntax error: missing ';' before '}'
1>C:\\Test\\TestDLL\\TestDLL\\TestDLL.cpp(36): error C4996: 'REALRegisterMethod': was declared deprecated
1>C:\\Test\\TestDLL\\TestDLL\\PluginMain.cpp(2489): note: see declaration of 'REALRegisterMethod'
1>Done building project "TestDLL.vcxproj" -- FAILED.
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
Here is my code in the TestDLL.cpp file:
[code]#if WIN32
#include “WinHeader++.h”
#endif
#include “rb_plugin.h”
#include “PluginMain.cpp”
//#include “rb_plugin_deprecated.h”
static double AddTwo(double x, double y);
REALmethodDefinition TestDLLMethods[] = {
(REALproc)AddTwo, REALnoImplementation, “AddTwo(x as double, y as double) as double”, REALconsoleSafe },
};
REALmoduleDefinition TestDLLDefinition = {
kCurrentREALControlVersion,
“TwoDLL”,
TestDLLMethods,
sizeof(TestDLLMethods) / sizeof(REALmethodDefinition),
nil,
0,
nil,
0,
nil,
0,
nil,
0
};
static double AddTwo(double x, double y) {
return x + y;
}
void PluginEntry(void) {
REALRegisterModule(&TestDLLDefinition);
for (long i = 0; i < (sizeof(TestDLLMethods) / sizeof(REALmethodDefinition)); i++) {
REALRegisterMethod(&TestDLLMethods[i]);
}
}[/code]
Here are the instructions to create the plugin:
[code]Manual create Visual Studio 2019 plugin
- Create a new project
- Dynamic-Link Library with exports (DLL)
- Name is TestDLL, at the location C:\Test\, Create
- Delete files: pch.h, framework.h, dllmain.cpp, pch.cpp, TestDLL.h, and cpp.hint
- In the file TestDLL.h, add the above code.
- Properties->C/C+±>Preprocessor->Preprocessor Definitions- Add IGNOREQT, Apply
- Properties->C/C+±>Code Generation->Runtime Library, change to Multi-threaded (/MT)
- Properties->C/C+±>Code Generation->Enable C++ Exceptions, change to No
- Properties->C/C+±>Language->Enable Run-Time Type Information, change to No
- Properties->C/C+±>Precompiled Headers->Precompiled Header, change to Not Using Precompiled Headers
[/code]
Press Build->Rebuild Solution.
Any tips or trick to make a Xojo plugin in Visual Studio 2019? And what is the rb_plugin_deprecated.h file used with in Visual Studio 2019?
Thanks for your help!