Hello,
I have been using a .NET Framework DLL in our Clarion application for many years without issues. We were recently forced to upgrade our library to .NET 8.0 due to a dependency update. Since the update, the Clarion app instantly crashes instantly when calling any of the exported DLL functions.
To simplify testing and remove variables, I have created a test app in Clarion 10 (using the Win32 EXE template) and a test library using the “CLR Class Library (.NET)” template in Visual Studio 2022.
I have tested linking to the library both statically (using both the built-in LibMaker.exe and LibMakerPlus from https://github.com/CarlTBarnes/LibMakerPlus) and also dynamically using the LoadLibrary() APIs without success. Note that when I create the same library from the “CLR Class Library (.NET Framework)” template in VS, both of the linking methods work without crashing.
Is there some extra configuration that I need to make in the .NET library to be compatible with Clarion?
My current library code looks like the following…
// Net.h
#pragma once
extern "C" __declspec(dllexport) int GetSeven();
// Net.cpp
#include "pch.h"
#include "Net.h"
int GetSeven()
{
return 7;
}
I am compiling in release mode targeting x86.
My Clarion app code looks like the following…
! Main procedure
Main PROCEDURE ! Declare Procedure
CODE ! Begin processed code
MESSAGE(GetSeven())
MESSAGE('Done!') ! This never gets called because Clarion crashes on the previous line
! Global map
MODULE('Net.lib')
GetSeven(),LONG,RAW,C
END
I have generated the LIB file using LibMaker.exe (the function shows up correctly in the preview) and added the library in the Solution Explorer.
I have been stuck on this for weeks, so any help would be greatly appreciated!
Thank you,
Brandon