Group Abstract Group Abstract

Message Boards Message Boards

Compiling properly in Visual Studio 2015

Posted 10 years ago

I'm trying to either DefineDLLFunction or LibraryLink to work with a Visual Studio 2015 compiled .dll. After days of trying, I am lost. Does anybody have a sample project that compiles properly?

Thanks

Tom

POSTED BY: Thomas Dobroth
3 Replies
Posted 10 years ago
POSTED BY: Thomas Dobroth
Posted 10 years ago

There are two tests, One for the LibraryFunction Load and one for

Here is the output for LibraryFunctionLoad:

In[11]:= $LibraryPath = Prepend[$LibraryPath, "C:\Users\Tom\OneDrive\Documents\Visual Studio \ 2015\Samples\librarylinktest\x64\Release\librarylinktest\"];

In[8]:= FindLibrary["librarylinktest"]

Out[8]= "C:\Users\Tom\OneDrive\Documents\Visual Studio \ 2015\Samples\librarylinktest\x64\Release\librarylinktest\\ librarylinktest.dll"

In[9]:= linktst = LibraryFunctionLoad["librarylinktest", "incrementInteger", {Integer}, Integer]

During evaluation of In[9]:= LibraryFunction::libload: The function incrementInteger was not loaded from the file C:\Users\Tom\OneDrive\Documents\Visual Studio 2015\Samples\librarylinktest\x64\Release\librarylinktest\librarylinktest.dll. >>

Out[9]= $Failed

In[10]:= fun = LibraryFunctionLoad["librarylinktest", "demoII", {Integer}, Integer];

During evaluation of In[10]:= LibraryFunction::libload: The function demoII was not loaded from the file C:\Users\Tom\OneDrive\Documents\Visual Studio 2015\Samples\librarylinktest\x64\Release\librarylinktest\librarylinktest.dll. >>

Here is the c code:

pragma once

DLLEXPORT mint WolframLibrary_getVersion() { return WolframLibraryVersion; }

DLLEXPORT int WolframLibrary_initialize(WolframLibraryData libData) { return LIBRARYNOERROR; }

DLLEXPORT void WolframDLL_uninitialize() { return; }

DLLEXPORT int incrementInteger(WolframLibraryData libData, mint Argc, MArgument * Args, MArgument Res) { mint I0; mint I1; I0 = MArgument_getInteger(Args[0]); I1 = I0 + 1; MArgument_setInteger(Res, I1); return LIBRARYNOERROR; } DLLEXPORT int demoII(WolframLibraryData libData, mint Argc, MArgument *Args, MArgument Res) { mint I0; mint I1; I0 = MArgument_getInteger(Args[0]); I1 = I0 + 1; MArgument_setInteger(Res, I1); return LIBRARYNOERROR; }

I am using a precompiled header that includes WolframLibrary.h (otherwise it would not compile.

POSTED BY: Thomas Dobroth

It would be helpful for you to show the work you have done so far, so that others have a better idea of what you want to do.

POSTED BY: EDITORIAL BOARD
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard