[Mono-list] need help getting started creating my own libraries
Fulko Hew
fulko.hew at gmail.com
Thu Dec 8 15:48:10 EST 2011
I know I'm probably not using the right terms for C# developers,
but I'm having troubles getting past the basics of C# naming, hierarchies
and directory and compiler usage. I'm new to C#/mono, but decades
in other stuff.
What I am trying to do is port a library I wrote in both Perl and Java
into C# so C# developers have a 'native' port.
Lets say my library ('mylib') consists of only two things right now:
myTypeA and myTypeB (that belong to my company 'xyz'.
And to use/test these library components I have a main app called 'tester'.
So what I was expecting to do was to create the following directory
structure:
./com.xyz.mylib/
myTypeA.cs
myTypeb.cs
./com.xyz.tester/tester.cs
a) is this a valid structure?
b) what compiler directives do I use to build my libraries?
d) what do I need inside 'tester.cs' to reference/load/import my library
components?
d) what compiler directives do I use to build my executable (linking in the
libraries)?
(I've been googling, but I find either the trivial 'hello world' example, or
abstract discussions. But I haven't found a simple tutorial for what I
need.)
I would expect to compile myTypeA and myTypeB into 'something'
ie. something like: gmcs -t:library myTypeA.cs
And then inside tester.cs have something like:
using com.xyz.mylib.myTypeA;
class tester {
static void Main() {
myTypeA x = new myTypeA();
... do stuff ...
}
}
The primary error I get now is:
testSnmpInteger.cs(2,7): error CS0246: The type or namespace name `com'
could not be found. Are you missing a using directive or an assembly
reference?
testSnmpInteger.cs(2,1): error CS0246: The type or namespace name
`mylib.myTypeA' could not be found. Are you missing a using directive or an
assembly reference?
But I haven't found/figured out how to structure the directories correctly,
and/or build the files correctly. I suspect there is a simple
answer... I just haven't found it yet. Any help would be
appreciated.
Fulko
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-list/attachments/20111208/8501c89d/attachment.html
More information about the Mono-list
mailing list