473,395 Members | 1,474 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

IntPtr in 64 bits PC

6
Hi everybody! i have a program in c# that use a method inside a c# dll that acts as a proxy to a c++ dll xD this works perfect in a x86 pc but when using in a x64 pc this thing just crash with the next error:

i think is something about IntPtr any ideas?...


System.BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)
at DLLProxy.OPCServer.CreateOPCServer()....

c# dll:
Expand|Select|Wrap|Line Numbers
  1.             [DllImport("kOpcClient.dll")]
  2.             static private extern IntPtr CreateOPCServer();
  3.  
  4.             private IntPtr m_pNativeObject;        // Variable to hold the C++ class's this pointer        
  5.  
  6.             public OPCServer()
  7.             {
  8.                 // We have to Create an instance of this class through an exported function
  9.                 this.m_pNativeObject = CreateOPCServer();
  10.             }            
  11.  
c++ dll:

Expand|Select|Wrap|Line Numbers
  1.  
  2. extern "C" L2KDLL_API CKServer* CreateOPCServer()
  3. {
  4.     return new CKServer();
  5. }
  6.  
  7.  
Apr 9 '09 #1
0 951

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Nuno Esculcas | last post by:
Hello, I come from C++ and i now have to work with C#, and someone tell me that bye bye pointers but i think this is not true, i must convert a DIB image in something that i can use in C# (like...
13
by: Christian Westerlund | last post by:
Hi! I'm trying to use P/Invoke and a Method which takes an IntPtr where I am supposed to put an address to a method which the native method will use to communicate back to me. How do I convert a...
10
by: Tamir Khason | last post by:
I have a pointer to array and I want to apply indexing to this Array so I have function (name it IntPrt Func) to go to certain member I can use (as C++) Func, but in C# I recieve an error "Cannot...
2
by: Alex Sedow | last post by:
Why explicit conversion from SomeType* to IntPtr is not ambiguous (according to standart)? Example: // System.IntPtr class IntPtr { public static explicit System.IntPtr (int); public...
6
by: active | last post by:
I downloaded the Win32 Library which saved me MUCH work. Some (All?) of the returned handles are typed int. As I used them I often changed them in my copy of win32 to IntPtr because an...
0
by: Jørn Jensen | last post by:
Hey! I have an issue with creating bitmap from an IntPtr. The IntPtr is created from a Twain scanner, which seem to work perfectly in it's original state (the app is originally written by somebody...
9
by: pigeonrandle | last post by:
Hi, I'm trying to convert the following line to c# from VB6 If hrRapiInit >= 0 Then 'SUCCEEDED where hrRapiInit is declared as a Long. In c#, hrRapiInit must be declared as an IntPtr to fit...
27
by: Eric | last post by:
Hi all, I have a C++ application that load C# applets. A method use an IntPtr parameter because I want to be 32/64-bit compatible. The problem is in the .tlh file generated. This parameter is...
11
by: Robert Dufour | last post by:
As a simple example starting with a memory pointer location I need to do 10 operations, (like copying 10 values to an array for instance), then when that's done, move the pointer to the eleventh...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.