Giter Club home page Giter Club logo

Comments (4)

youyuanwu avatar youyuanwu commented on July 21, 2024 1

Using "LoadLibrary" suggested solved the issue.

from cswin32.

AArnott avatar AArnott commented on July 21, 2024

Would specifying System32 | ApplicationDirectory | AssemblyDirectory be sufficient here? If not, what would be required?

from cswin32.

youyuanwu avatar youyuanwu commented on July 21, 2024

FabricCreateLocalClient function comes from FabricClient.dll. This dll lives inside directory C:\Program Files\Microsoft Service Fabric\bin\Fabric\Fabric.Code and is in the system env:PATH variable.

So to make this work the code needs to find FabricClient.dll in the right directory.
I am not familiar with the dll searching in cs. But given the generated code, I think

[DefaultDllImportSearchPaths("C:\Program Files\Microsoft Service Fabric\bin\Fabric\Fabric.Code")] 

might work?
Is it possible to look up dll in the system PATH like native application?

from cswin32.

AArnott avatar AArnott commented on July 21, 2024

You can't specify a path like that. The attribute only takes a flags enum. You can see the options here.

I'm not aware of any setting that will simply search all the directories in PATH for dependencies, even in native applications. I think native apps have the same set of options that is exposed to .NET applications through that enum.
Note that, per the docs in the enum, an AddDllDirectory win32 function exists whereby you can explicitly add a directory to the dll search path. Then you'd need to set the UserDirectories flag on the enum so that .NET would honor that.

Frankly though, I think the simplest path for you may be to find the file yourself and load it using LoadLibrary. Once loaded, these p/invokes will work regardless of this enum.

from cswin32.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.