❔ How to use DLL?

Hi guys, so i am trying to make a console application and need to use some functionality in these dll's. I use those residing in the bin folder. i have tried to import nistmsclp_2gb.dll however i get an ": 'Could not load file or assembly 'nistmsclp_2gb.dll' or one of its dependencies" when i try to use some functionality. So this leads me to think that i need to import other dll's beside this wrapper dll, i however get an error "please make sure that the file is accessible and that it is a valid assembly or com component" when i try to import the native libraries whether it's x86 or x64. Any idea how to go about this? Thanks! I have included some documentation below.
51 Replies
Monsieur Wholesome
Is it an open source / public library?
Ertan Köse
Ertan KöseOP2y ago
yes kind of it's a NIST library
Monsieur Wholesome
I'd like to try it out myself, do you have a link? Hmm, a direct download link? Youve got a link to a site perhaps?
Ertan Köse
Ertan KöseOP2y ago
Nope sorry, it looks sketch i know but it's safe lol
Jimmacle
Jimmacle2y ago
i mean, it's the legit nist site
Ertan Köse
Ertan KöseOP2y ago
Exactly
Jimmacle
Jimmacle2y ago
not saying everyone should just download it, but it's better than some random domain
Ertan Köse
Ertan KöseOP2y ago
I just need to use it to use their search function
Monsieur Wholesome
What does your code look like?
Ertan Köse
Ertan KöseOP2y ago
Monsieur Wholesome
Within your project, create a folder called something like "deps" or "dependencies" Or maybe even smth like "native"
Monsieur Wholesome
And copy those in there
Jimmacle
Jimmacle2y ago
could be that the DLLs are referenced but aren't being copied to the build directory
Monsieur Wholesome
And then change all the .dll properties in the solution explorer to "copy if newer"
Monsieur Wholesome
Then try again their sample csharp app has a 4k loc program.cs lol
Jimmacle
Jimmacle2y ago
rip scientists aren't known for pretty code
Monsieur Wholesome
hence python is popular
Ertan Köse
Ertan KöseOP2y ago
i swear and their documentation isn't exactly user friendly lol but im on it!
Monsieur Wholesome
you got this does this work for you @Ertan Köse ? I lied btw, their source code for Program.cs is a bit above 6k loc
Ertan Köse
Ertan KöseOP2y ago
i was getting some snack doing it now 🙂
Monsieur Wholesome
tis gon be a long night
Ertan Köse
Ertan KöseOP2y ago
Ok so unfortunately same error, i loaded them in as you said and change it to copy if newer
Ertan Köse
Ertan KöseOP2y ago
btw thank you i appreciate it!
Monsieur Wholesome
urgh, i hate this It does work, it's just that it copies it into a deps sub folder output >.> One sec, imma look for a proper copying solution Open your .csproj file, and drop the following in there
<ItemGroup>
<None Update="deps\ctnt66_64.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<TargetPath>ctnt66_64.dll</TargetPath>
</None>
<None Update="deps\InpMzxml64.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<TargetPath>InpMzxml64.dll</TargetPath>
</None>
<None Update="deps\libinchi64.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<TargetPath>libinchi64.dll</TargetPath>
</None>
<None Update="deps\nistdl64_2gb.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<TargetPath>nistdl64_2gb.dll</TargetPath>
</None>
<None Update="deps\nistmsclP_2gb.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<TargetPath>nistmsclP_2gb.dll</TargetPath>
</None>
<None Update="deps\zlib1_x64.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<TargetPath>zlib1_x64.dll</TargetPath>
</None>
</ItemGroup>
<ItemGroup>
<None Update="deps\ctnt66_64.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<TargetPath>ctnt66_64.dll</TargetPath>
</None>
<None Update="deps\InpMzxml64.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<TargetPath>InpMzxml64.dll</TargetPath>
</None>
<None Update="deps\libinchi64.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<TargetPath>libinchi64.dll</TargetPath>
</None>
<None Update="deps\nistdl64_2gb.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<TargetPath>nistdl64_2gb.dll</TargetPath>
</None>
<None Update="deps\nistmsclP_2gb.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<TargetPath>nistmsclP_2gb.dll</TargetPath>
</None>
<None Update="deps\zlib1_x64.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<TargetPath>zlib1_x64.dll</TargetPath>
</None>
</ItemGroup>
@Ertan Köse
Ertan Köse
Ertan KöseOP2y ago
Okey on it
Ertan Köse
Ertan KöseOP2y ago
Okey same error but here is the thing the build action is set to content in the dll's do i perhaps need to change this maybe to embedded ressource, and do i still need the reference?
Ertan Köse
Ertan KöseOP2y ago
Did you get it to work?
Monsieur Wholesome
Yes, I did Nah, keep it as is
Monsieur Wholesome
works for me
Monsieur Wholesome
Show your csproj
Ertan Köse
Ertan KöseOP2y ago
holy moly 🙂 worst case i could use your console folder!
Ertan Köse
Ertan KöseOP2y ago
Ertan Köse
Ertan KöseOP2y ago
Monsieur Wholesome
youve got the same references in there twice >.> Also, why tf are you on .net framework disgustang
Ertan Köse
Ertan KöseOP2y ago
Hahah man i don't know any better what sdk version are you on?
Monsieur Wholesome
.net 7
Ertan Köse
Ertan KöseOP2y ago
omg
Monsieur Wholesome
$newproject
MODiX
MODiX2y ago
When creating a new project, prefer using .NET over .NET Framework, unless you have a very specific reason to be using .NET Framework. .NET Framework is now legacy code and only get security fix updates, it no longer gets new features and is not recommended. https://cdn.discordapp.com/attachments/569261465463160900/899381236617855016/unknown.png
Ertan Köse
Ertan KöseOP2y ago
thanks!!! im downloading it now btw do you have any resources to point me towards so i can learn this kind of stuff better
Monsieur Wholesome
what kinda stuff
Ertan Köse
Ertan KöseOP2y ago
Not the language c# itself but more .net itself i guess any book would do
Monsieur Wholesome
you dont learn that kinda stuff from books in my view you learn it over time
Ertan Köse
Ertan KöseOP2y ago
Actually true
Ertan Köse
Ertan KöseOP2y ago
@chatgpt plus user it's a success!! Thank you very much! You are truly an awesome person!
Monsieur Wholesome
beep boop
Ertan Köse
Ertan KöseOP2y ago
Facts
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server