Using custom DLL with Citect 8.2

I am trying to use a custom DLL developed in VStudio 2022 in Citect 2018 R2 (8.2)
I have followed the document "Creating Custom .NET DLLs in Vijeo Citect 2015.pdf" and created the DLL with constructor, and property and methods etc.
I have the DLL built in C# and working properly with a Test App (also done in C#)
I have created an msi and installed the DLL and test App in the Citect pc.
However, I am having trouble using the DLL in Citect, both DLLOpen and also DllClassCreate not returning valid object handle.
I have also tried adding the DLL installed folder to Path but no success.

Is anyone there had success doing a similar thing? What are the rules for a DLL to be able to be used in Citect?

Parents
  • I am doing the same thing right now. I created a .dll to call, run, control the volume, and stop multiple audio files on demand. I also had the same problem as you at first. Ultimately, the problem wasn't on the Citect end. It ended up being a dependencies problem with the .dll. There were methods used in the .dll that required functionality from other .dlls that wasn't present or in the same location as the machine the .dll was written on.. When my .dll was called it was looking for other, dependent .dlls that weren't where my .dll was expecting them to be. Subsequently, it wouldn't work.

    How I fixed the problem was by compiling all of the dependent methods and functions into my .dll. I am sorry, it has been over ten years since I've done any programming in .NET Studio, so I don't remember the exact options you need to choose in the compiler options section of .NET Studio, but at least for me I got it to work by choosing the compiling options that caused all of the functions and methods used by my .dll to be compiled into my .dll. This ended up making my .dll somewhat of a self-supporting program that didn't rely on any external dependencies because they were already internally compiled into mine. Somebody more current and familiar with .NET Studio programming could probably help you out with that.

    The only "drawback", if you can call it that, is file size. When I originally compiled my .dll with external dependencies, the file size was @ 80 KB. When I compiled my .dll with the dependencies compiled in, the file size went to @ 2 MB. However, with as much storage as is available in modern computers, I would think that this wouldn't be a real problem for you.

  • Thanks for the detailed reply.

    I have simplified the dll code (as a test) so that no other dll's coming in addition to the direct project related ones. But I am still getting the same error at the time of DLLOpen: "GetProcAddress failed. LastError=127" (DllClassCreate does not give such detailed response). GetProcAddress error comes when I enter non-existing function too, meaning the function seems to not been exposed although I have defined it as a Public function..!  (my application is in C#)

    As Bart suggested earlier I have used .Net Standard 2.1 as Target framework for the class library (yes, I do use Class Library template).

  • I always use the .net framework 4.8.1 for the class library.

Reply Children
No Data