473,800 Members | 2,689 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ArgumentExcepti on in MethodInfo Invoke with non-native arguments

Hello I'm trying to load dinamically some dll's but when I try to invoke
one method, I ever get ArgumentExcepti on if I'm not using native types.
Here are the .h of the dll:

#pragma once
#include <windows.h>
#include <gl/gl.h>
#include <gl/glu.h>

using namespace System;
namespace NShaderDesigner
{

public __gc struct ProceduralTextu reData
{
GLint internalFormat;
GLenum format;
GLubyte primaryPointer __gc[];
GLubyte _X __gc[];
GLubyte Y __gc[];
GLubyte _Y __gc[];
GLubyte Z __gc[];
GLubyte _Z __gc[];
};

__gc class Plugin
{
public:
bool PluginTexture(P roceduralTextur eData *data);
};
}
//--------------------------------------------------------
// Here are the .cpp of the dll
//--------------------------------------------------------
#include "ShaderDesigner SDK.h"

using namespace System;
using namespace NShaderDesigner ;

bool Plugin::PluginT exture(Procedur alTextureData *data)
{

return true;
}
//--------------------------------------------------------
// here are the call code
//--------------------------------------------------------

System::Void Textures::LoadP luginTexture(in t i)
{
Assembly *a = Assembly::LoadF ile(caps->textureFileNam e[i]);
Type *t = a->GetType("Plugi n");
MethodInfo *mi = t->GetMethod("Plu ginTexture");
Object *o = Activator::Crea teInstance(t);
ProceduralTextu reData *p[] = new ProceduralTextu reData*[1];
p[0] = new ProceduralTextu reData;
mi->Invoke(o,p);
}

//--------------------------------------------------------
// Here are the declaration of ProceduralTextu reData into the call code
//--------------------------------------------------------
namespace NShaderDesigner
{
public __gc struct ProceduralTextu reData
{
GLint internalFormat;
GLenum format;
GLubyte primaryPointer __gc[];
GLubyte _X __gc[];
GLubyte Y __gc[];
GLubyte _Y __gc[];
GLubyte Z __gc[];
GLubyte _Z __gc[];
};
}

Anyone could help me?
Thank you very much
Nov 17 '05 #1
0 1483

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2493
by: Nony Buz | last post by:
My objective is simply: Notify a form when a image file has been created in a directory. First there is a basic interface for the callback function: public interface INewImageNotify { void notify_NewImage(string imageName); } Then there is the delegate:
14
7355
by: stic | last post by:
Hi, I'm in a middle of writing something like 'exception handler wraper' for a set of different methodes. The case is that I have ca. 40 methods form web servicem, with different return values (and types), and with out parmeters. What I want to do is to support each method call with exception (http 404, soap exception, and other types of exceptions) and wrap it with try & catch (a lots of catch ;-)
1
2204
by: Sivaraman.S | last post by:
Hi, Can i pass integer array to methodInfo.Invoke(obj,args()). I am able to pass only string array to this function. This is the code i have written. Dim myType As Type = objClass.GetType() Dim myMethod As MethodInfo = myType.GetMethod("strFnName") myMethod.Invoke(objClass, Args) here "strFnName" is the function name and args() is the string array. args()
3
9584
by: Me | last post by:
I am trying to figure out any issues with calling System.Reflection.MethodInfo.Invoke() when dealing with multiple threads. For instance.. Say I have a class that allows you to pass in a string that represents a method name and an object that represents an instance of some class which contains the previous function name. Now, I want to execute that method name by calling the Invoke() method of MethodInfo similar to the following...
2
12316
by: Phill W. | last post by:
For some time, I've been adding "trace level" logging to my code using Imports System.Reflection Private Function XYZ( a1 as A, b1 as B, c1 as C, ... TRACE.Log( MethodBase.GetCurrentMethod().Name _ , a1, ba, c1 ) but recently, I noticed one of my colleagues using this instead
1
12701
by: ian | last post by:
Hi, I can't find a solution to this, so I've brought it to the experts. Using reflection I can get a MethodInfo object pointing at an assembly's method. Where I have a MethodInfo object pointing at a function, say func(int p1, ref int p2), how do I read p2 after a successful invocation? I've tried interogating the parameterinfo objects on the method, I've seen some hints about overriding something or casting some other object type to...
2
3051
by: John Lutz | last post by:
Our app is mainly COM based. We allow .NET plug-ins. When a plug-in is installed, it receives a COM pointer to the app. The plug-in implements our IExtensionImpl interface and gets the app pointer through the OnCreate method... public void OnCreate(IApplication pApp)... The plug-in that I'm working on also allows sub-plug-ins. These sub-plug-ins are simple DLLs that provide methods that are accessed via Reflection.
3
3416
by: Lambuz | last post by:
Hi all, when I use MethosInfo.Invoke method I obtain a TargetInvocationException where inner exception is +{"classBase.OpenConn cannot be invoked directly" } System.Exception. I'm using the following class public abstract class classBase{ public static int OpenConn(){ ....
15
8212
by: =?Utf-8?B?VG9tIENvcmNvcmFu?= | last post by:
I've been led to believe by several articles, particularly Eric Gunnerson's C# Calling Code Dynamically, that calling a method dynamically through Reflection was much slower than through a Delegate. My testing showed that actually it was six times faster: 0.5 seconds for 100,000 iterations versus 3.1 seconds. Can anyone explain why? Something in the way I coded it? I'd appreciate any insights. Here's the code (in a Windows Form...
11
23661
by: KMinFL | last post by:
This is a C# VS 2008 question... Our system has 2 base classes, SingleEntity and NewPluralEntity. SingleEntity provides access to properties and methods related to manipulating data in a database table and NewPluralEntity is a generic base class that I inherit from to create strongly typed collections of single entities. Here is the declaration of our NewPluralEntity class: public abstract class NewPluralEntity<T> : ICollection<T>,...
0
9690
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9551
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10504
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10274
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10251
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10033
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9085
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6811
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5606
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.