|
OK, I suggest you use DUMPBIN or some other tool to verify the symbols exported by your DLL file.
BTW: you are not getting confused (or confusing your tools) by having several copies of the DLL in different places, other folders, GAC, ...?
FWIW: I tend to use C, not C++, for native code, avoiding all name mangling. Never had such problems.
|
|
|
|
|
Thanks Luc. I got the symbol from the VdrDll.exp file (exports library file), which seems to work for the other exported functions.
I tried renaming the generated DLL, and got the expected missing module error message.
Yes, C would be simpler, but I'm trying to leverage a massive existing code base already in C++.
|
|
|
|
|
Hi Alan,
I did some experiments using VS2008 Express for both C++ and C# and all went well, here is the relevant code:
#define NATIVECPPEXPERIMENT_API __declspec(dllexport)
NATIVECPPEXPERIMENT_API int fint1(int arg1) {
return arg1*arg1;
}
NATIVECPPEXPERIMENT_API int fint4(int arg1,int arg2, short* arg3, int arg4) {
*arg3=(short)(arg1*arg2);
return arg1*arg4;
}
namespace ConsoleApplication1 {
class Program {
static void log(string s) {Console.WriteLine(s);}
static void Main(string[] args) {
int res1=cppfint1(12);
log("res1="+res1);
short shrt=14;
int res4=cppfint4(12,13,ref shrt, 15);
log("res4="+res4);
log("shrt="+shrt);
Console.ReadLine();
}
[DllImport("nativeCppExperiment.dll", EntryPoint="?fint1@@YAHH@Z")]
static extern int cppfint1(int arg1);
[DllImport("nativeCppExperiment.dll", EntryPoint="?fint4@@YAHHHPAFH@Z")]
static extern int cppfint4(int agr1, int arg2, ref short arg3, int arg4);
}
}
So either you are overlooking something, or your system is ill. I suggest you try closing and reopening Studio, and consider rebooting.
|
|
|
|
|
Thanks again for the help Luc! Your code looks perfect. This is what I tried to do with the ref parameter.
I've been experimenting, and taking out the EntryPoint clause allowed the linker to find the function:
[DllImport("vdrdll.dll")]
static unsafe extern void drawMarkupOnLine(int jobId, int lineNumber, short* line, int drawMode);
I don't understand why this worked. Now I'm getting a read/write-protected-memory exception, but this may just be a "normal" bug.
|
|
|
|
|
Alan Balkany wrote: taking out the EntryPoint clause allowed the linker to find the function
That is amazing, if not impossible. I've never read that should work.
I tried it for my second call, and I immediately got an EntryPointNotFoundException, as I was expecting.
namespace ConsoleApplication1 {
class Program {
static void log(string s) {Console.WriteLine(s);}
static void Main(string[] args) {
int res1=cppfint1(12);
log("res1="+res1);
short shrt=14;
int res4=fint4(12,13,ref shrt, 15);
log("res4="+res4);
log("shrt="+shrt);
Console.ReadLine();
}
[DllImport("nativeCppExperiment.dll", EntryPoint="?fint1@@YAHH@Z")]
static extern int cppfint1(int arg1);
[DllImport("nativeCppExperiment.dll")]
static extern int fint4(int agr1, int arg2, ref short arg3, int arg4);
}
}
Your system is acting weird if you ask me.
|
|
|
|
|
I took your advice and restarted the system, and did a Rebuild Solution on both halves. The results were the same; it links perfectly with the Entry Point left out for only that function.
"Your system is acting weird if you ask me."
I blame Microsoft.
|
|
|
|
|
|
could it be you have a C-version of that function somewhere?
or a hidden extern "C" { ... } around it?
|
|
|
|
|
Neither of those are present. (Looking around, I can see you've been busy today!)
Thanks again for the help!
|
|
|
|
|
No problem.
|
|
|
|
|
How do I access the data coming in and out of the USB Port on a PDA using C#. My PDA is not a host, but I should still be able to communicate with a Host. I do not want to use the Active Sync. Any help and code snippets would be greatly appreciated.
|
|
|
|
|
You can use SerialPort class or this library for communicating directly with Usb port: LibUsbDotNet[^]
|
|
|
|
|
Thanks for your prompt response.
Using the SerialPort class or the LibUsbDotNet works fine from the PC side, but not on the PDA. How do I read the USB info on a PDA using Windows Mobile?
|
|
|
|
|
function tes(){
var xmlSOAP = new ActiveXObject("MSXML2.DOMDocument");
chunkCompressed='apakah &apakah';
alert(chunkCompressed.length+" "+chunkCompressed );
var param='<?xml version="1.0" encoding="utf-8"?>'+
'<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">'+
'<soap:Body>'+
'<UploadData xmlns="http://tempuri.org/">'+
'<chunk xmlns:dt="urn:schemas-microsoft-com:datatypes" dt:dt="string">'+chunkCompressed+'</chunk>'+
'</UploadData>'+
'</soap:Body>'+
'</soap:Envelope>';
xmlSOAP.loadXML(param);
alert(param);
xmlSOAP.save("D:\\tes.xml");
my error in character &, how to solve the problem , so i can write & in my xml file, thx
regards
novhard
|
|
|
|
|
|
|
I don't know about the original poster, but I found that to be really helpful. Thanks
|
|
|
|
|
glad to help
|
|
|
|
|
thx for reply my message, i am oredy solve the problem too
thank you very much ..^.^
|
|
|
|
|
Hey there,
my department is developing process software. We now want to desing product specific addins wich we can auto install on our machines. But we do not have any expirence.
Can anyone help us with a tutorial or does somebody knows some books where we can get this know how?
Thanks for any help,
greetings Martin
|
|
|
|
|
|
|
|
Hey all,
you gave me a lot help to find a way.
But now a have a little problem with the types. When I want to make a new instance of my plugin, I get a Exepction: Type could not be converted to this type.
I made an interface named "IPluginInterface" and Implemented it into my plugin. Now I want to make a new instance of the plugin and cast it as "IPluginInterface" but then I got this exception.
Has someone an Idea?
Greetings,
Martin Müller
|
|
|
|
|
Dear sir,
i have created a project like xlite(pc to pc calling), all thing is working but after recieving call sound is not comming. for that any sound codecs are required??
plz tell me .
|
|
|
|