.native file is not generated

25 views
Skip to first unread message

Vincent Boilay

unread,
Mar 30, 2015, 7:00:37 AM3/30/15
to cppsha...@googlegroups.com
Hello,
new to cppsharp.
It took me a while to get it compiled.
My first try generated the wrapper all right but I am missing the .native file (I used Basic.cs as base example)

I wrote a simple C++ project : MyMathFuncs
I have then saved MyMathFuncs.h and MyMathFuncs.lib in C:\Users\vince\Documents\projects\MyFirstCppSharpStuff\libsToWorkOn\

the override Setup() of ILibrary is like:


            options.Headers.Add("MyMathFuncs.h");
            options.Libraries.Add("MyMathFuncs.lib");
            options.addIncludeDirs(@"C:\Users\vince\Documents\projects\MyFirstCppSharpStuff\libsToWorkOn\");
            options.addLibraryDirs(@"C:\Users\vince\Documents\projects\MyFirstCppSharpStuff\libsToWorkOn\");


The process generates MyMathFuncs.cs but not the "native" one.
Therefore in another project using MyMathFuncs.cs the DllImport("MyMathFuncs.Native",...  does not work.

any hint how to get the MyMathFuncs.Native created ?


My SetupPasses is as follow:

        public override void SetupPasses(Driver driver)
        {
            if (driver.Options.IsCSharpGenerator)
                driver.Options.GenerateAbstractImpls = true;
            driver.Options.GenerateVirtualTables = true;
            driver.Options.GenerateCopyConstructors = true;
            driver.Options.MarshalCharAsManagedChar = true;
            driver.Options.GenerateProperties = true;
            driver.Options.GenerateConversionOperators = true;
        }

Thanks.

Vincent Boilay

unread,
Mar 30, 2015, 11:17:36 AM3/30/15
to cppsha...@googlegroups.com
Sorry for the stupid question.....
Forget about that.

meanwhile what if I do not have the DLL but just a .lib ?

João Matos

unread,
Mar 30, 2015, 4:53:05 PM3/30/15
to Vincent Boilay, cppsha...@googlegroups.com
C#'s P/Invoke mechanism is based on importing symbols at runtime from a DLL. So assuming your .lib is a static library, you can either use the C++/CLI interop mechanism to statically link the library with your generated bindings code or create a DLL from the static library (which I assume is possible though I don't know offhand the details on how to do it).

--
You received this message because you are subscribed to the Google Groups "CppSharp" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cppsharp-lis...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
João Matos
Reply all
Reply to author
Forward
0 new messages