How can I rename the library name, specific for module?
I have following set up 4 dlls: dll_a, dll_b, dll_c, dll_d. Some of them use each other. Each has it's own separate header dll_a.h, dll_b.h, dll_c.h, dll_d.h (sorry if I write something that sounds weird to C guy, I don't know C much). Each of the header is located in the different folder, and has additional includes.
My current setup is next (simplified);
var options = driver.Options;
options.GeneratorKind = GeneratorKind.CSharp;
options.LibraryName = "PLT";
options.NoGenIncludeDirs = new List<string>();
options.NoGenIncludeDirs.Add("dll_a/");
options.NoGenIncludeDirs.Add("dll_b/");
options.NoGenIncludeDirs.Add("dll_c/");
options.NoGenIncludeDirs.Add("dll_d/");
var aModule = new Module();
options.Modules.Add(aModule );
aModule .LibraryName = "dll_a";
aModule .Headers.Add("dll_a/dll_a.h");
var bModule = new Module();
options.Modules.Add(bModule );
bModule .LibraryName = "dll_b";
bModule .Headers.Add("dll_b/dll_b.h");
var cModule = new Module();
options.Modules.Add(cModule);
cModule .LibraryName = "dll_c";
cModule .Headers.Add("dll_c/dll_c.h");
var dModule = new Module();
options.Modules.Add(dModule );
dModule .LibraryName = "dll_d";
dModule .Headers.Add("dll_d/dll_d.h");
This generates different classes for extern calls (named dll_a, dll_b...), but every of them has [DllImport("PLT", ...], when I want [DllImport("dll_a", .. for dll_a, [DllImport("dll_b", ..] for dll_b.
I've also tried having separate ILibrary for each of the header, but this generates copies of data structures (for example dll_c has datastructure used in API for dll_a and dll_b, thus it is generated 3 times). They become not interchangable, so I cannot call:
var stuff = dll_a.GetStuff();
dll_b.ConsumeStuff(stuff); // Conversion error: cannot cast dll_a.Stuff to dll_b.Stuff
P.S. Is this correct way to ask questions? As I understood google group is not monitored too much.
Try the SharedLibraryName option.
And yes, it's fine to ask questions here.
@tritao That still applies the shared name to all of the modules. What I need is specific name for each module (in particular the name of the header file)
You could use CheckSymbols = true but this will only work if you pass your libraries themselves to your set up, per module - module.LibraryPaths.Add("path_to_dll_a") and module.Libraries.Add("dll_a").
Alternatively, @tritao 's suggestion works too. SharedLibraryName is a per module setting as well so you can have different ones as necessary.
@ddobrev I've tried setting it up per module, but it still applied one of them (it applied dll_b - the second one, which is weird). But your suggestion with CheckSymbols = true worked nicely, thanks!